Hello,
I have the following code attached to one of my text box so that when the user enters a tech_ID in the L_TECH # text box the tech's name automatically poplulates in the L_TECH text box. What I didn't think about is if the person doesn't have a tech_ID. Does anyone know how I would minipulate my code?
I want to change it so if the person doesn't have a tech_ID, that text box can be left blank and the user then has to enter the non-tech person's name. Can this be done?
I have to confess one of my coworkers helped me with this code and he is on vacation as of yesterday. I thank you in advance for your help with this matter.
I have the following code attached to one of my text box so that when the user enters a tech_ID in the L_TECH # text box the tech's name automatically poplulates in the L_TECH text box. What I didn't think about is if the person doesn't have a tech_ID. Does anyone know how I would minipulate my code?
I want to change it so if the person doesn't have a tech_ID, that text box can be left blank and the user then has to enter the non-tech person's name. Can this be done?
Code:
Private Sub L_TECH___AfterUpdate()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset( _
"SELECT NAME From TECH " & _
"WHERE TECH_ID= " & Me.L_TECH__)
If Not (rst.EOF And rst.BOF) Then
'/now populate the textboxes
Me.L_TECH = rst("NAME")
End If
Set rst = Nothing
End Sub
I have to confess one of my coworkers helped me with this code and he is on vacation as of yesterday. I thank you in advance for your help with this matter.