By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,620 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,620 IT Pros & Developers. It's quick & easy.

fields and forms

P: n/a
I have two tables and two forms, "Patient Details", "Placement
Details".

In the "Patient Details" form, I have the name and addresses fields. I
want to update the addresses fields automatically once the name field
has been filled in. I have tried Dlookup but what else have I missed
out on. Also the Gp Practice fields and the GP Code fields needs this
done as well.

=DLookUp("[Gpcode]","[Conwydata]","[Gpcode] =""" & [gp_practice] &
"""")

Is there something that I have missed to get this working.

Also

When the patient's name and data in the "Patient Details" form is
completed then I have
a button on that form to go to the "Placement Details" form but I would
like the "Patients name" autofilled on the 2nd form from the 1st form
when they click on the "Placement Details" button.

Private Sub Patientdetails_Click()
On Error GoTo Err_Patientdetails_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Placement Details"

stLinkCriteria = "[Fullname]=" & "'" & Me![surname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Patientdetails_Click:
Exit Sub

Err_Patientdetails_Click:
MsgBox Err.Description
Resume Exit_Patientdetails_Click

End Sub
Anyone got any ideas as to where I am going wrong, new to MS Access -
got the fundementals right just got to get the Advanced stuff now, boss
said no money for courses so struggling on, on my own.

Elaine

Aug 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think instead of all the DLookups, you would be better off to have
your form bound to the table. Make the record source of the form your
PatientDetails table. Now for each field on your form, make the
control source one of the fields in your table. When you create your
dropdown box, when the wizard starts select the third option. Find a
record based on the value I select. You should select the PatientID
and name fields.

If you want your name to display LastName, FirstName change the
rowsource of the dropdown to Select PatientID, Lastname & ", " &
FirstName From [Patient Details];
Change the number of colums to 2, the column widths to 0;1, and the
bound column should be 1.

For your other form, again have it bound to Placement Details. When
you open the form, your stLinkCriteria should be: PatientID =
Me.FullName
I chose FullName for the name of the drop down box. If you call it
something else, then substitute that name for FullName.

Hope that helps!
Elainie wrote:
I have two tables and two forms, "Patient Details", "Placement
Details".

In the "Patient Details" form, I have the name and addresses fields. I
want to update the addresses fields automatically once the name field
has been filled in. I have tried Dlookup but what else have I missed
out on. Also the Gp Practice fields and the GP Code fields needs this
done as well.

=DLookUp("[Gpcode]","[Conwydata]","[Gpcode] =""" & [gp_practice] &
"""")

Is there something that I have missed to get this working.

Also

When the patient's name and data in the "Patient Details" form is
completed then I have
a button on that form to go to the "Placement Details" form but I would
like the "Patients name" autofilled on the 2nd form from the 1st form
when they click on the "Placement Details" button.

Private Sub Patientdetails_Click()
On Error GoTo Err_Patientdetails_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Placement Details"

stLinkCriteria = "[Fullname]=" & "'" & Me![surname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Patientdetails_Click:
Exit Sub

Err_Patientdetails_Click:
MsgBox Err.Description
Resume Exit_Patientdetails_Click

End Sub
Anyone got any ideas as to where I am going wrong, new to MS Access -
got the fundementals right just got to get the Advanced stuff now, boss
said no money for courses so struggling on, on my own.

Elaine
Aug 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.