Hello everyone.
I'm running the following code in a procedure and it is giving a Type mismatch message. I can't figure out why it won't accept the Select statement. I checked the code and the values are being passed as expected.
Public Function SeekFactor(Yr) As Single
Dim rst As Recordset
Dim the_sql As String
Dim yyr As String
yyr = CStr(Yr)
the_sql = "select TheFactor from schemaname_tblfactor where TheAge = '" _
& yyr & "'" & " and ThePercent = '" & txtPct & "'"
Set rst = CurrentDb.OpenRecordset(the_sql)
If Not rst.EOF Then
nFactor = rst!TheFactor
Else
nFactor = 0
End If
rst.Close
Set rst = Nothing
End Function
-> TheAge and ThePercent fields are type Text. The variables txtPct and yyr are set as type String. txtPct is a Public variable.
-> My database is in Oracle connected by DSN. The tables are linked under Tables objects.
Any suggestions?
Thanks.
I'm running the following code in a procedure and it is giving a Type mismatch message. I can't figure out why it won't accept the Select statement. I checked the code and the values are being passed as expected.
Public Function SeekFactor(Yr) As Single
Dim rst As Recordset
Dim the_sql As String
Dim yyr As String
yyr = CStr(Yr)
the_sql = "select TheFactor from schemaname_tblfactor where TheAge = '" _
& yyr & "'" & " and ThePercent = '" & txtPct & "'"
Set rst = CurrentDb.OpenRecordset(the_sql)
If Not rst.EOF Then
nFactor = rst!TheFactor
Else
nFactor = 0
End If
rst.Close
Set rst = Nothing
End Function
-> TheAge and ThePercent fields are type Text. The variables txtPct and yyr are set as type String. txtPct is a Public variable.
-> My database is in Oracle connected by DSN. The tables are linked under Tables objects.
Any suggestions?
Thanks.