Can someone please take a look at this select case & tell me what I'm doing wrong? I'm trying to grab data from a field in a table based on two columns in the same table.
However one variable comes from a Mainframe System and the other from a dropdown on the form.
Getting "No Current Record" as the error on Case 5. What does that mean.....
Dim intTMO_RATE As Integer (dropdown values 5, 7, 10, 15, 20)
Dim strNew_PromoID As String * 8 (value I want to get from table)
Dim strPromoID As String * 8 (value from Mainframe)
Dim rst As DAO.Recordset
intTMO_RATE = rstBatchAA254Partition.Fields("Rate").Value strSQL_AA254 = "SELECT * FROM [FRL CODES] WHERE [20YR]= '" & strPromoID & "';"
Set rst = CurrentDb.OpenRecordset(strSQL_AA254)
Select Case intTMO_RATE
Case 5
strNew_PromoID = rst.Fields("5YR").Value
Case 7
strNew_PromoID = rst.Fields("7YR").Value
Case 10
strNew_PromoID = rst.Fields("10YR").Value
Case 15
strNew_PromoID = rst.Fields("15YR").Value
Case 20
strNew_PromoID = rst.Fields("20YR").Value
End Select
MsgBox "new id is" & strNew_PromoID
rst.Close: Set rst = Nothing
~Thanks CBO
However one variable comes from a Mainframe System and the other from a dropdown on the form.
Getting "No Current Record" as the error on Case 5. What does that mean.....
Dim intTMO_RATE As Integer (dropdown values 5, 7, 10, 15, 20)
Dim strNew_PromoID As String * 8 (value I want to get from table)
Dim strPromoID As String * 8 (value from Mainframe)
Dim rst As DAO.Recordset
intTMO_RATE = rstBatchAA254Partition.Fields("Rate").Value strSQL_AA254 = "SELECT * FROM [FRL CODES] WHERE [20YR]= '" & strPromoID & "';"
Set rst = CurrentDb.OpenRecordset(strSQL_AA254)
Select Case intTMO_RATE
Case 5
strNew_PromoID = rst.Fields("5YR").Value
Case 7
strNew_PromoID = rst.Fields("7YR").Value
Case 10
strNew_PromoID = rst.Fields("10YR").Value
Case 15
strNew_PromoID = rst.Fields("15YR").Value
Case 20
strNew_PromoID = rst.Fields("20YR").Value
End Select
MsgBox "new id is" & strNew_PromoID
rst.Close: Set rst = Nothing
~Thanks CBO