In a form, when I update a combo box field, I want to grab some extra fields from the lookup table and populate some fields on the current form. Here is my code...
Private Sub Project_ID_AfterUpdate()
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim strSQL As String
If Project_ID <> Null Then
strSQL = "SELECT STO_ID, ProjectNo, InfraProjectNo"
strSQL = strSQL & " FROM tblProjects"
strSQL = strSQL & " WHERE Project_ID = '" & Me.Project_ID & "';"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
ProjectNo = rs!ProjectNo
InfraProjectNo = rs!InfraProjectNo
STO_ID = rs!STO_ID
Me.Refresh
End If
End Sub
It won't fall into the If Project_ID <> Null Then code which I checked with a breakpoint inside the If..End. I put a breakpoint on the If statement itself and mouse over the values. Project_ID = 16 and Null = Null. Any ideas? Thanks!