Susan Allen Wyoming
Registered User.
- Local time
- Today, 19:27
- Joined
- Feb 15, 2001
- Messages
- 22
I have been working on trying to create duplicate price tags for the last two weeks.
I created a button with the following code behind it. It works without any errors, but I'm not getting too many price tags when I preview the report. I tested it with two items on order and I got over 5 pages of price tags.
I also am getting an error on an item called Marshall's Seedless Ash. This is a text field. I'm assuming its because of the apostraphe, but I don't know what to do because that is the name of the product.
Any thoughts? Please help!!!
''''''''''''''''''''''''''''''''''''
Private Sub cmdPriceLabels_Click()
Dim dbs As Database
Dim rst As Recordset
Dim strSql As String
Dim ordered As Integer
Dim i As Integer
Dim stDocName As String
Dim result As Integer
result = MsgBox("You have chosen to make labels for the products"_
& "listed on this Purchase Order. This procedure may take a few"_
& "moments.", vbOKCancel, "Label Generation Procedure")
If result = vbCancel Then
Exit Sub
Else
DoCmd.SetWarnings False
ordered = 0
Set dbs = CurrentDb
strSql = "Select
DescripName,ProdSize,ProdRetail,ProdID,OrderID,OrderTotal
FROM qryOrders" _
& "WHERE POID = " & Me.POID & ";"
Set rst = dbs.OpenRecordset(strSql, dbOpenSnapshot)
If rst.RecordCount > 0 Then
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
i = 1
ordered = rst!OrderTotal
For i = 1 To ordered
DoCmd.RunSQL ("INSERT INTO TempPriceLabels
(ProdID,OrderID,DescripName,ProdRetail,ProdSize) VALUES('" _
& rst!ProdID & "', "& rst!OrderID & "', & rst!DescripName & "', "&
rst!ProdRetail & "', rst!ProdSize & ");")
Next
rst.MoveNext
Loop
End If
MsgBox "The labels have been created. Opening Labels in Print
Preview"_
& ".", , "Labels Created"
stDocName = "rptPriceLabels"
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.RunSQL ("DELETE * from TempPriceLabels;")
DoCmd.SetWarnings = True
End If
End Sub
'''''''''''''''''''''''''''''''''''''''
Thanks Sue
I created a button with the following code behind it. It works without any errors, but I'm not getting too many price tags when I preview the report. I tested it with two items on order and I got over 5 pages of price tags.
I also am getting an error on an item called Marshall's Seedless Ash. This is a text field. I'm assuming its because of the apostraphe, but I don't know what to do because that is the name of the product.
Any thoughts? Please help!!!
''''''''''''''''''''''''''''''''''''
Private Sub cmdPriceLabels_Click()
Dim dbs As Database
Dim rst As Recordset
Dim strSql As String
Dim ordered As Integer
Dim i As Integer
Dim stDocName As String
Dim result As Integer
result = MsgBox("You have chosen to make labels for the products"_
& "listed on this Purchase Order. This procedure may take a few"_
& "moments.", vbOKCancel, "Label Generation Procedure")
If result = vbCancel Then
Exit Sub
Else
DoCmd.SetWarnings False
ordered = 0
Set dbs = CurrentDb
strSql = "Select
DescripName,ProdSize,ProdRetail,ProdID,OrderID,OrderTotal
FROM qryOrders" _
& "WHERE POID = " & Me.POID & ";"
Set rst = dbs.OpenRecordset(strSql, dbOpenSnapshot)
If rst.RecordCount > 0 Then
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
i = 1
ordered = rst!OrderTotal
For i = 1 To ordered
DoCmd.RunSQL ("INSERT INTO TempPriceLabels
(ProdID,OrderID,DescripName,ProdRetail,ProdSize) VALUES('" _
& rst!ProdID & "', "& rst!OrderID & "', & rst!DescripName & "', "&
rst!ProdRetail & "', rst!ProdSize & ");")
Next
rst.MoveNext
Loop
End If
MsgBox "The labels have been created. Opening Labels in Print
Preview"_
& ".", , "Labels Created"
stDocName = "rptPriceLabels"
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.RunSQL ("DELETE * from TempPriceLabels;")
DoCmd.SetWarnings = True
End If
End Sub
'''''''''''''''''''''''''''''''''''''''
Thanks Sue