O
Olu Solaru
The subject is pretty self-explanatory. I have tried using the DLookup
option too. But I can't seem to get my text fields to auto-populate based on
my selection in the combo box. Not quite sure if this is the right forum,
please redirect if so. The Combo Box is doing a search by BprNumber - which
has a text value (combination of numbers/text)
Code Sample :
Private Sub cboBpr_AfterUpdate()
On Error Resume Next
cboBpr.SetFocus
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
cboBpr.SetFocus
If cboBpr.Value > 0 Then
strSQL = "SELECT * FROM tblBPRNumber WHERE BPRNumber = """" &
cboBpr.Value"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If Not rs.BOF Then
Me.ProcessDate = rs("ProcessDate")
Me.Sop1 = rs("Sop1")
Me.Sop2 = rs("Sop2")
Me.Sop3 = rs("Sop3")
Me.Sop4 = rs("Sop4")
Me.Sop5 = rs("Sop5")
Me.Sop6 = rs("Sop6")
Me.Sop7 = rs("Sop7")
Me.Sop8 = rs("Sop8")
Me.Sop9 = rs("Sop9")
Me.Sop10 = rs("Sop10")
Me.Sop11 = rs("Sop11")
Me.Sop12 = rs("Sop12")
Me.Sop13 = rs("Sop13")
Me.Sop14 = rs("Sop14")
Me.Sop15 = rs("Sop15")
Me.Sop16 = rs("Sop16")
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End If
End Sub
option too. But I can't seem to get my text fields to auto-populate based on
my selection in the combo box. Not quite sure if this is the right forum,
please redirect if so. The Combo Box is doing a search by BprNumber - which
has a text value (combination of numbers/text)
Code Sample :
Private Sub cboBpr_AfterUpdate()
On Error Resume Next
cboBpr.SetFocus
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
cboBpr.SetFocus
If cboBpr.Value > 0 Then
strSQL = "SELECT * FROM tblBPRNumber WHERE BPRNumber = """" &
cboBpr.Value"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If Not rs.BOF Then
Me.ProcessDate = rs("ProcessDate")
Me.Sop1 = rs("Sop1")
Me.Sop2 = rs("Sop2")
Me.Sop3 = rs("Sop3")
Me.Sop4 = rs("Sop4")
Me.Sop5 = rs("Sop5")
Me.Sop6 = rs("Sop6")
Me.Sop7 = rs("Sop7")
Me.Sop8 = rs("Sop8")
Me.Sop9 = rs("Sop9")
Me.Sop10 = rs("Sop10")
Me.Sop11 = rs("Sop11")
Me.Sop12 = rs("Sop12")
Me.Sop13 = rs("Sop13")
Me.Sop14 = rs("Sop14")
Me.Sop15 = rs("Sop15")
Me.Sop16 = rs("Sop16")
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End If
End Sub