Hi All,
What I'm trying to do seems simple enough yet I can't get it to work. I am querying a database and I want a text to display based on my IF Then statement. However, it seems as though my select query is only reading my most recent value in my table instead of the select values according to my where statement. Any help would be greatly appreciated. Thanks
Private Sub cmbTankNum_Change()
Dim stSql As String
Dim rs As Object
Dim con As Object
Set con = Application.CurrentProject.Connection
stSql = "Select [LotNum] FROM [Blendsheet Input]"
stSql = stSql & " WHERE [TankNum] = '" & cmbTankNum.Value & "'"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
TxtStatus.SetFocus
If [LotNum] = True Then
TxtStatus.Text = ("Finalled")
Else
TxtStatus.Text = ("jermaine")
End If
rs.Close
Set rs = Nothing
Set con = Nothing
Exit_Close_Click:
Exit Sub
End Sub
What I'm trying to do seems simple enough yet I can't get it to work. I am querying a database and I want a text to display based on my IF Then statement. However, it seems as though my select query is only reading my most recent value in my table instead of the select values according to my where statement. Any help would be greatly appreciated. Thanks
Private Sub cmbTankNum_Change()
Dim stSql As String
Dim rs As Object
Dim con As Object
Set con = Application.CurrentProject.Connection
stSql = "Select [LotNum] FROM [Blendsheet Input]"
stSql = stSql & " WHERE [TankNum] = '" & cmbTankNum.Value & "'"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
TxtStatus.SetFocus
If [LotNum] = True Then
TxtStatus.Text = ("Finalled")
Else
TxtStatus.Text = ("jermaine")
End If
rs.Close
Set rs = Nothing
Set con = Nothing
Exit_Close_Click:
Exit Sub
End Sub