I have a form that has several fields, one of which is called Pro_ID. I
would like to use whatever number is entered in that field to run a query
that fills in the rest of the fields with information associated with that
Pro_ID. The code below is what I have so far, but it does not work (I keep getting errors on lines 4 and 5). Any ideas as to what is wrong? Thanks.
would like to use whatever number is entered in that field to run a query
that fills in the rest of the fields with information associated with that
Pro_ID. The code below is what I have so far, but it does not work (I keep getting errors on lines 4 and 5). Any ideas as to what is wrong? Thanks.
Code:
Private Sub Pro_ID_AfterUpdate()
Dim strSQL As String
Dim rs As DAO.Recordset
strSQL = "SELECT [prov1].LAST_NAME, [prov1].FIRST_NAME FROM [prov1] WHERE
[prov1]=" & Me.txtPro_ID
Set rs = CurrentDb.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
Me.txtLAST_NAME = rs.Fields![ LAST NAME]
Me.txtFIRST_NAME = rs.Fields![FIRST NAME]
End If
rs.Close
Set rs = Nothing