P
Pat
Hey all, with a new version of Office once again comes a question from me
about adjusting my coding. I'm still very much new to learning the Visual
Basic language so bear with me if you find the answer to be blantantly
obvious.
Here is my code as is:
Private Sub cmdPrintInvoice_Click()
On Error GoTo Err_Handler
DoCmd.RunCommand acCmdSaveRecord
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptInternationalInvoice"
strCriteria = "[InvoiceID]=" & Me![InvoiceID]
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error# " & Err.Number & "" & Err.Description
End If
Resume Exit_This_Sub
End Sub
What this does is I fill out information in a form, in this case for
creating a commercial invoice, and then I click a button which calls this
procedure above to send the info to a report that I can then print out. The
form has a subform which contains the product list while the main form has
all the other information. Now, this worked fine with Office 03. But of
course Office 07 comes along and now I get nothing.
Here's a bit of weirdness to throw at you. If I select an invoice that's
already in the database and change the product contents and address,
basically everything, then I click the Print button and it works just fine.
If I create a new record on the other hand, it allows me to fill out all the
information just fine but when I click on that print button I get a report
without any data to it AND if I go back to the form again it doesn't
recognize that any data was ever entered much less a new record created. So
basically I'm stuck now with 19 different invoices and it won't save anymore.
Completely weird! But again, knowing this crowd one of you will probably
immediately see the problem in my coding. And how I came up with this code
was originally off a forum just for MS Access years ago and this current form
of the code came from one of you here. Thank you again whoever you are!
Worked great while it did.
So any thoughts at all on this are greatly welcomed. And along those lines,
if one of you cares to explain the procedures used in the coding including
the different parameters and such I'd certainly enjoy the bit of education.
Thanks all!
about adjusting my coding. I'm still very much new to learning the Visual
Basic language so bear with me if you find the answer to be blantantly
obvious.
Here is my code as is:
Private Sub cmdPrintInvoice_Click()
On Error GoTo Err_Handler
DoCmd.RunCommand acCmdSaveRecord
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptInternationalInvoice"
strCriteria = "[InvoiceID]=" & Me![InvoiceID]
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error# " & Err.Number & "" & Err.Description
End If
Resume Exit_This_Sub
End Sub
What this does is I fill out information in a form, in this case for
creating a commercial invoice, and then I click a button which calls this
procedure above to send the info to a report that I can then print out. The
form has a subform which contains the product list while the main form has
all the other information. Now, this worked fine with Office 03. But of
course Office 07 comes along and now I get nothing.
Here's a bit of weirdness to throw at you. If I select an invoice that's
already in the database and change the product contents and address,
basically everything, then I click the Print button and it works just fine.
If I create a new record on the other hand, it allows me to fill out all the
information just fine but when I click on that print button I get a report
without any data to it AND if I go back to the form again it doesn't
recognize that any data was ever entered much less a new record created. So
basically I'm stuck now with 19 different invoices and it won't save anymore.
Completely weird! But again, knowing this crowd one of you will probably
immediately see the problem in my coding. And how I came up with this code
was originally off a forum just for MS Access years ago and this current form
of the code came from one of you here. Thank you again whoever you are!
Worked great while it did.
So any thoughts at all on this are greatly welcomed. And along those lines,
if one of you cares to explain the procedures used in the coding including
the different parameters and such I'd certainly enjoy the bit of education.
Thanks all!