Hi,
I had a problem since converting from Access 97 to Access 2003. What I am trying to do is print the same basic report but with different values that come from a query. Pasted below is the code it breaks at "rst.[CoatingNumber]" and gives an error message of "Method or data member not found". It work fine in Access 97. I have searched for help and checked a few things. In the References, the dao3.6 object library is select but lower on the priority than the 11.0 object library. I could not move the dao 3.6 to higher priority. Please take a offer any advice as our manufacturing facility uses this daily.
Thanks,
DF
Private Sub PrintAllBatchReports_Click()
On Error GoTo Err_PrintAllBatchReports_Click
Dim stDocName As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim strFCriteria As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("PaintMixOrderPrintOut")
While Not rst.EOF
strFCriteria = "[Coating Number]=" & rst.[CoatingNumber] & " and [ProdLine]=" & rst.[ProdLine] & " and [Tank]='" & rst.[Tank] & "'" & " and [AutoNumber]=" & rst.[AutoNumber]
strCriteria = "[Amount]=" & rst.[Amount] & " and [Coating Number]=" & rst.[CoatingNumber] & " and [AutoNumber]=" & rst.[AutoNumber]
If rst.Amount = 0 And rst.AmountBatch = "b" Then
DoCmd.OpenReport "FullBatchFormula", acNormal, , strFCriteria
End If
If rst.Amount > 0 Then
DoCmd.OpenReport "PartialBatchFormula", acNormal, , strCriteria
End If
rst.MoveNext
Wend
DoCmd.OpenReport "PaintMixOrderReport", acNormal
rst.Close
dbs.Close
Set rst = Nothing
Exit_PrintAllBatchReports_Click:
Exit Sub
Err_PrintAllBatchReports_Click:
MsgBox Err.Description
Resume Exit_PrintAllBatchReports_Click
End Sub
I had a problem since converting from Access 97 to Access 2003. What I am trying to do is print the same basic report but with different values that come from a query. Pasted below is the code it breaks at "rst.[CoatingNumber]" and gives an error message of "Method or data member not found". It work fine in Access 97. I have searched for help and checked a few things. In the References, the dao3.6 object library is select but lower on the priority than the 11.0 object library. I could not move the dao 3.6 to higher priority. Please take a offer any advice as our manufacturing facility uses this daily.
Thanks,
DF
Private Sub PrintAllBatchReports_Click()
On Error GoTo Err_PrintAllBatchReports_Click
Dim stDocName As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim strFCriteria As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("PaintMixOrderPrintOut")
While Not rst.EOF
strFCriteria = "[Coating Number]=" & rst.[CoatingNumber] & " and [ProdLine]=" & rst.[ProdLine] & " and [Tank]='" & rst.[Tank] & "'" & " and [AutoNumber]=" & rst.[AutoNumber]
strCriteria = "[Amount]=" & rst.[Amount] & " and [Coating Number]=" & rst.[CoatingNumber] & " and [AutoNumber]=" & rst.[AutoNumber]
If rst.Amount = 0 And rst.AmountBatch = "b" Then
DoCmd.OpenReport "FullBatchFormula", acNormal, , strFCriteria
End If
If rst.Amount > 0 Then
DoCmd.OpenReport "PartialBatchFormula", acNormal, , strCriteria
End If
rst.MoveNext
Wend
DoCmd.OpenReport "PaintMixOrderReport", acNormal
rst.Close
dbs.Close
Set rst = Nothing
Exit_PrintAllBatchReports_Click:
Exit Sub
Err_PrintAllBatchReports_Click:
MsgBox Err.Description
Resume Exit_PrintAllBatchReports_Click
End Sub