I'm wanting to select a [name] on the form, and it to automatically fill in the [acro]. I've added a msg so I can see what it's doing and it's showing the code "SELECT [Contractors Table].acro FROM [Contractors Table]WHERE(([Contractors Table].Name)=[forms]![frmcmcstaff]![cmbname]);", not the answer. Can you help me out please?
Private Sub cmbName_AfterUpdate()
Dim dbs As DAO.Database, rst As DAO.Recordset, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT [Contractors Table].acro " & _
"FROM [Contractors Table]" & _
"WHERE(([Contractors Table].Name)=[forms]![frmcmcstaff]![cmbname]);"
MsgBox strSQL
Set rst = dbs.OpenRecordset(strSQL)
Me![txtAcro] = "I-T-S/" & rst![Acro]
End Sub
Private Sub cmbName_AfterUpdate()
Dim dbs As DAO.Database, rst As DAO.Recordset, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT [Contractors Table].acro " & _
"FROM [Contractors Table]" & _
"WHERE(([Contractors Table].Name)=[forms]![frmcmcstaff]![cmbname]);"
MsgBox strSQL
Set rst = dbs.OpenRecordset(strSQL)
Me![txtAcro] = "I-T-S/" & rst![Acro]
End Sub