Aug 2 2006, 02:21 AM
My db tracks patients. At one point the nurse has to click on tasks performed for the patient (toggle buttons). On click of a toggle button, I need a short text string to go into fieldA in the table, as well as a numeric value to go into fieldB in the table. Fields A are later printed out as a handover from one nursing shift to another and fields B are used by management to calculate the "acuity" of the patient.
I have tried doing this by putting lots of invisible controls on the form, to hold the text strings and the numeric values, before writing the final concatenated text string to field A, and to hold the numeric values - and perform a simple calculation on the numeric values - before writing the result into the table.
I realise that this is not the proper way to do things. I suspect I should use variables in code to hold these values, perform the calculations, etc. But, being an amateur Access programmer (I'm a doctor), I don't know enough about setting up these variables (their datatype, scope, and all those things!). I have read James Foxall's Visual Basic 2005, and this gives me some idea ...
I hope someone can point me in the right direction. I appreciate any help you can give me.
Aug 2 2006, 03:22 AM
put the fields you want to change on the form, but make their VISIBLE property=No
Then, when you change a visible field that impacts an invisible one, use the AfterUpdate event of the control to change the invisible field
"before writing the final concatenated text string to field A"
rather than storing a concatenated field, store the components of the string -- you can always concatenate them for reporting -- much easier!
Aug 2 2006, 03:37 AM
Thanks for your advice. I think I did not make myself very clear. Let me try again!
I have gone the way of putting invisible controls on the form, then change their content on click of the visible toggle buttons. I understand your advice about the concatenation.
The problem is that I end up with a toggle button, and two invisible controls, i.e. 3 controls for every click that I need. And I need up to 70 toggle buttons to cover all the options that the nurses can click on, so that means more than 200 controls per page. I think there must be a better way of doing this. I suspect I could use only the visible toggle button, and hold the "invisible" data in variables behind the toggle button.
I've experimented with "private" and "public" and "subs" and "functions" in the code behind my toggle buttons, but I end up in such a messy tangle that I'm at the point of giving up. Am I barking up the wrong tree?
Thanks for your help
Aug 3 2006, 02:43 AM
if you are stuck on the idea on toggles, name them* sequentially so that you can loop thru them in code...
* NAME property of the controls
here is something that would be good to read -- especially the secion on properties and methods:
Access Basics For Programminghttp://www.utteraccess.com/forums/showflat...;Number=1220772
it doesn't apply to your situation directly, but will give some good background.
"...with a toggle button, and two invisible controls..."
it would be good to see what your database looks like -- can you post it and specify what to look at?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here