Hi! My first post in this excellent forum is a question:
I am running a report in Access97, it comes from a query called "Select Date Range". I have this code so far in the Detail_Print sub.
My problem is that it gets to this line:
If rs1!ChainCode = "TA002" Then
and tells me "Type Mismatch" with
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
highlighted and the "=" selected. The ChainCode field is from the query "Select Date Range" which queries a table where ChainCode comes from, and it is set as a Text data type.
I have never had this problem before with comparing data to another. I have a feeling the ChainCode data type and the TA002 I'm comparing it to aren't the same. I would like to avoid changing the data type in the main table it originates from.
Any ideas would be welcome.
BenjiS
I am running a report in Access97, it comes from a query called "Select Date Range". I have this code so far in the Detail_Print sub.
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim StrTSInvNum As String
Dim StrUSFInvNum As String
Dim StrTA002 As String
Dim rs1 As Database
Dim db As Database
Set rs1 = db.OpenRecordset("Select Date Range", dbOpenTable)
Text44.Form.Visible = True
Label43.Form.Visible = True
If rs1!ChainCode = "TA002" Then
StrTSInvNum = rs1!TruckStopInvoiceNum
Text44.Form.Caption = Left(StrTSInvNum, 2)
Else
Text44.Form.Visible = False
Label43.Form.Visible = False
End If
If rs1!ChainCode = "US004" Then
StrUSFInvNum = rs1!TruckStopInvoiceNum
Text44.Form.Caption = StrUSFInvNum
Else
Text44.Form.Visible = False
Label43.Form.Visible = False
End If
End Sub
My problem is that it gets to this line:
If rs1!ChainCode = "TA002" Then
and tells me "Type Mismatch" with
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
highlighted and the "=" selected. The ChainCode field is from the query "Select Date Range" which queries a table where ChainCode comes from, and it is set as a Text data type.
I have never had this problem before with comparing data to another. I have a feeling the ChainCode data type and the TA002 I'm comparing it to aren't the same. I would like to avoid changing the data type in the main table it originates from.
Any ideas would be welcome.
BenjiS