Kevin Welch wrote:
Looking for some expert help here.
Caveat: I do not know SQL, and I've built a database basically by trial and
error (unfortunately, I don't have much time to learn Access as I would
want).
My basic database form is for patients, and I store their info in the
database and link to videos of surgery, etc. I made a switchboard, a few
queries, and a few reports that I can use to look at categories, etc.
However, instead of run a report or add new form or edit form, I want to go
to a specific form. Example, to go patient John Doe's form, a window would
prompt me to enter the last name and it would go directly to that patient's
form. In the queries I made, I could just type [Enter patient name] under
the criteria and it would prompt me to enter the name when running the
query. Any way to do that for the GoToRecord macro or otherwise?
Thanks so much.
Hmmmm...for simplicity...what I would consider is creating a form for
your patients. The Form's recordsource might me
Patients
or something like
Select * From Patients
This form would select and display each patient record.
Once you have that set up, drag the Detail bar down from the FormHeader
bar. Then pull up to toolbox and drag a combobox to the header area.
You'll have 3 options; the third is Find A Record based on value of
Combo box. Select that and follow the wizard.
Next, let's say the ComboBox's name is Combo6. And you have a field
called PatientID that's the primary key and is the first (hidden) field
in the combo. In the OnCurrent event of the form you could have
something like
Me.Combo6 = IIF(Not Me.NewRecord,Me.PatientID,0)
This will assign the combo to the currect patient record or 0 to a new
record with no patient displayed.
After you add a new record, you'll want to requery the combo (so the new
patient is listed in the combo. In the form's AfterUpdate event you
could do something like
If Me.combo6 = 0 Then
Me.Combo6.Requery
Me.Combo6 = Me.PatientID
Endif
Now you can find the PatientID from the same form by selection the
Patient from the dropdown.