looking up value programetically

D

dave

help! please
hy i have a form name marketers on which i have a control named(doctorid)
which is generating the autonumbers based on the first argument,(that is if
visitype= first visit), it works fine, now the problem i have is if its not
"first visit" then i want this sub to find a record and show in
control(doctorid) the value from tabel.(second argument), i have query which
returns me a value i want based on the current forms first and last name
control field, and i cant run the sql since it does not allow select
statements in this procedures.(SELECT MARKETERS.DOCTORID
FROM MARKETERS WHERE (((MARKETERS.LAST)=FORMS!MARKETERS.LAST) And
((MARKETERS.FIRST)=FORMS!MARKETERS.FIRST));).
can i do something here in the code after elseif so i can get similar result
as the above query and i can show that in the doctorid control and then be
able to save it to the table with rest of the record.(just for info: i hade
doctor id control as a combo box and as raw source the above query was
working fine, but i want to change it to text box so the value of doctorid
displays automatically based on the last and first name condition and user
dont have to click there)

Private Sub doctorid_GotFocus()
Dim doctorid As Long
Dim SQL As String
If VISITTYPE = "First Visit" Then
Forms!marketers!doctorid = Nz(DMax("[DOCTORID]", "MARKETERS"), 0) + 1
ElseIf VISITTYP = "FOLLOWUP" Or "ENTERTAINMENT" Then
-----do something here which display the doctor id based on current forms
last and first name.

thank you
 

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

Similar Threads


Top