Help with opening form from another form using a query


G

Guest

Ok , I know the discription is a bit much.
This is what I have so far.

I have my main switch board , we wll call Main
Main opens up when I open the DB
Main has 2 buttons new patient and open patient
We are dealing with open patient
When the open patient button is selected it goes to another form - patient
selector
patient selector has a combo box tied to a query.
The query can return results based off of a patients or MD's last name or
letters and a wild card.
So I get the patient selected that I want so far.
Now is where I am having problems.
The patient that I have selected in the patient selector I want it to open
up a form called Patient Viewer, and for all the data associated to this
patient to populate the form.
THe form Patient Viewer I created using form design and then "add exisiting
fields" button on the design tab. Thus ensuring that alkl hte fields that I
have on the form are tied to a field on a table. All assiciated by primary
keys.
 
Ad

Advertisements

G

Guest

Hi Benny

One way would be to include the PatientID in the combo as the bound field.
Then use the AfterUpdate event of the combo to open the form Patient Viewer.


Private Sub PatientSelector_AfterUpdate()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Patient Viewer"
stLinkCriteria = "[PatientID]=" & Me![PatientSelector]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


Note - change the names to what they really are.

Hope this helps
 

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