Autosearch (1 Viewer)

Monardo

Registered User.
Local time
Today, 07:19
Joined
Mar 14, 2008
Messages
70
Hello guys

I am very new to Access, but not new to databases (I have been using other epidemiological software). I would like to know if it is possible to do the following:

the database is about patients, who have there unique numbers (identifier). I want in the form when doctor enters the patient number if that number exists in the database that the form automatically jumps to that record (so that patient info could be updated), or if number is "new" it creates a new record and allows doctor to enter patient data from scratch.

Probably you guessed that this was possible in the software which I was using previously.

I hope I explained well what I'm seeking for, and thank you for your help in advance.
 

DCrake

Remembered
Local time
Today, 05:19
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

Assuming your form is a bound form, ie has a recordsource for each control on the form. Make the patient id an unbound control - this is where you will enter the patient id. Once the user has done so use a Dlookup to see if the number exists in the table. If it does then use the Me.Filter to apply the filter to the form (Me.Filter = "[PatientID]=" & TxtPatientID)

If it doesn't then you could either tell the user it does not exist and do they want to retry again? Or you could say somthing on the lines of
If MsgBox("This ID does not exist in the database! Do you want to add a new patient?",vbQuestion,vbYesNo,vbDefaultButton2,"Cannot find " & TxtPatientID & " In database.") = vbYes Then

..Do this

Else

..Do that

Endif

CodeMaster::cool:
 

Monardo

Registered User.
Local time
Today, 07:19
Joined
Mar 14, 2008
Messages
70
Thanks a lot I will try that
 

Users who are viewing this thread

Top Bottom