Combo Box Choice to go to Either Form or Other Combo Box

M

Maurita

I am creating the second database for a Free Clinic on a volunteer
basis, and am having trouble with a Combo Box issue. I have searched
this Group's database, but have had no luck with this issue. I have a
combo box "Combo29" that has two choices "PS" for previously seen and
"NP" for new patient. If the user clicks on "NP", I want the
PATIENT-Form to open so that new patient information can be entered,
and the user will click a command button to return to the form which
automatically saves the new patient information. I also have a
"Command28" going to the PATIENT-Form. I'm not sure which would be the
best approach to use, the command button or going directly to the
PATIENT-Form when "NP" is clicked. As to the second choice in
"Combo29", if "PS" is clicked, I need to go to another combo box
"Combo7" which lists names of previously seen patients. The user can
then choose a previously seen patient, which will automatically bring
up basic patient information in the subform "Patient Basic Info -
Subform", based on the PATIENT-Table.

This approach created a compile error:
If Me!Combo29 = "PS" Then
DoCmd.GoToControl "Command28", , , , , acNormal
ElseIf ...

This approach created an error stating that the PATIENT-Form did not
exist:
IF Me!Combo29 = "PS" then
DoCmd.OpenForm "PATIENT - Form", , , , , acNormal
ElseIf...

Thank you in advance for any help you can send my way.

Maurita
 
J

Jeff L

This approach created a compile error:
If Me!Combo29 = "PS" Then
DoCmd.GoToControl "Command28", , , , , acNormal
ElseIf ...

You have a bunch of extra junk there. It's just Docmd.GotoControl
"Command28"
This approach created an error stating that the PATIENT-Form did not
exist:
IF Me!Combo29 = "PS" then
DoCmd.OpenForm "PATIENT - Form", , , , , acNormal
ElseIf...

If you have spaces in your form name, you need to put square brackets
around the name, [PATIENT - Form].

Just a suggestion: You will find it extremely beneficial if you give
your controls more meaningful names and not Combo29, Command28, etc.
It will make your code much easier to debug, and others in your work
place will not be cursing your name should they have to fix or debug
something.

Hope that helps!
 
S

Svetlana

You could just create 2 forms.
One could be a Navigation form and the other the Patient form.

The first form could contain a combobox and a command button.

The combobox contains the names of the patients.
Everytime the user chooce a name of the dropdown list then the Patient
form
opens to the particular record.
The command button opens the Patient form having the DataEntry property
set to Yes
for enter a new record (patient).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top