Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dont know about recordsets!!!

Status
Not open for further replies.

PamSt

Technical User
Nov 27, 2002
9
Hi I feel a little dumb but I have to ask, I have a database I built in access with a little code put in. I have a registration form for patient check in with all the normal demo stuff. What I would like it to do is on the “after update on the social security number field” do a query of the registration table and if there is a matching record open another form to show the data of that patient (ssn, patient name, patient address) I have asked about this on tek-tips before and got a response about opening a recordset but just can’t figure out how to do create the recordset and add the data to the second form only if there are matching records. I have checked HELP and but cannot seem to pass the values, I think I need help on getting started. Thank you any help you can give (you can tell don’t know much about coding but I am trying)
 
How are ya PamSt . . .

Have a look at [blue]DLookUp[/blue] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
To add to what AceMan said a dlookup returns null if it can not find a matching record. So you could do something like this (untested).
Table name: tblPatients
field name: SSN
form name: frmPatientDetails

dim strWhere as string
strWhere = "SSN = '" & me.SSN & "'"
'or if ssn is number
'strWhere = "SSN = " & SSN
if not isnull(dlookup("SSN","tblPatients",strWhere) then
docmd.openform "frmPatientDetails",,,strWhere
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top