aprilmarie
Technical User
Private Sub cboPlant_Change()
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Dim strPlant As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Plants"
strPlant = vbNullString
strSQL = vbNullString
Me.cboPlant.SetFocus
strPlant = Me.cboPlant.Text
strSQL = "SELECT Program FROM Plants WHERE Plant = " & strPlant & ";"
rst.MoveFirst
Do While Not rst.EOF
rst.MoveNext
Loop
txtProgram.SetFocus
Me.txtProgram.Value = strSQL
rst.Close
dbs.Close
End Sub
What is wrong with this?
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Dim strPlant As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Plants"
strPlant = vbNullString
strSQL = vbNullString
Me.cboPlant.SetFocus
strPlant = Me.cboPlant.Text
strSQL = "SELECT Program FROM Plants WHERE Plant = " & strPlant & ";"
rst.MoveFirst
Do While Not rst.EOF
rst.MoveNext
Loop
txtProgram.SetFocus
Me.txtProgram.Value = strSQL
rst.Close
dbs.Close
End Sub
What is wrong with this?