How to automatically insert criteria in a query.

normski

Registered User.
Local time
Today, 11:44
Joined
Dec 8, 2006
Messages
20
hey all, In my database (For a doctors practice) I have individual patient records with information about them on there. There are 5 boxes showing the current medication, if any, that they are on. The form is all linked up and so when I go through each record for each patient all the data changes as it should. I have a seperate table with all of the drug information on it and I want to be able to click on the box on the patient form (One of the boxes that has one of their medications in) and I want it to be able to automatically put the name of that drug in a search query and bring up the results in a report or form view. Is it possible to do this?

So far I have managed to create a control button on the pateint data form and when clicked, it asks for a a parameter value i.e. the name of the drug. I'd like to be able to miss out this step and for it to automatically enter the name of the drug from the text box into the serach criteria.

PLEASE HELP! I need this urgently!

Thank you for your time.
normski
 
i presume the parameter is entered in the criteria row of a query. replace this with a direct reference to the text box on your form

=forms!formname!textboxname

instead of prompting you for the drug name, it should take the value directly from the form. The syntax for referring to controls on forms (and particularly on sub-forms of forms) has to be precise - Access has help and there is lots of info in this forum. (i think this is the right syntax, but it may not be exactly right)
 
Thank you for your help, the textbox containing the drug name (I.e the parameter value that I want to be automatically inputed into the criteria) is called textbox63.

The form name with the text box on is called Individual Patient Data and the table I get the drug information from in the first place that is displayed in the "textbox63" is called Individual Drug data. Could you please write out that criteria code with the correct headings please? I tried it myself and it didn't work!
 

Users who are viewing this thread

Back
Top Bottom