Creating, saving and printing invoices in Access 2007 - URGENT

K

Kim Irvine

HI

I have set up a database for an Assessing company and basically have a few tables that all work the way I want them to. The problem is they have ME reports and Invoices. Now I can get the invoices to print. I have an expenses sub-form on the Claims Details page and a claims payment subform. These work and I can print invoices.
The problem is I need to be able to have an Invoice ID and would like to keep the invoices to view and reprint when the company wants to. Also they need to be able to add a second invoice to the same claim if necessary.
You enter a new claim and all of it's details. Then when you click on the MEReport button it must either create a new report (this procedure is a bit tricky as depending on selections from two combo boxes it must open that particulart form). Here [Our Reference] is entered and this is the field that if blank it must create a new MEReport if not then it must open the report to be viewed.
This is what I have for this code:
Private Sub cmdCreateMEReport_Click()
On Error GoTo Err_MEReport_Report_Click
Dim stDocName As String
If Me![Project Name] = "REPAIR" Or Me![Project Name] = "WRITE OFF" Then
If Me![Project Name] = "REPAIR" And Me![Category] = "BUS" Then stDocName = "ME Report Default Repair"
If Me![Project Name] = "REPAIR" And Me![Category] = "CARS AND 4WD's" Then stDocName = "ME Repair Car"
If Me![Project Name] = "REPAIR" And Me![Category] = "CARAVAN" Then stDocName = "ME Repair Caravan"
If Me![Project Name] = "REPAIR" And Me![Category] = "MOTORBIKE 2" Then stDocName = "ME Repair MBike2"
If Me![Project Name] = "REPAIR" And Me![Category] = "MOTORBIKE 3" Then stDocName = "ME Repair MBike3"
If Me![Project Name] = "REPAIR" And Me![Category] = "MOTORBIKE 4" Then stDocName = "ME Repair MBike4"
If Me![Project Name] = "REPAIR" And Me![Category] = "TRAILER" Then stDocName = "ME Repair TRAILER"
If Me![Project Name] = "HAIL DAMAGE" And Me![Category] = "HAIL DAMAGE" Then stDocName = "ME Hail"
If Me![Project Name] = "HAIL DAMAGE AND ACCIDENT" And Me![Category] = "CARS AND 4WD's" Then stDocName = "ME Hail Car"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "Bus" Then stDocName = "ME WO Bus"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "CARS AND 4WD's" Then stDocName = "ME WO Car"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "CARAVAN" Then stDocName = "ME WO Caravan"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "MOTORBIKE 2" Then stDocName = "ME WO MBike2"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "MOTORBIKE 3" Then stDocName = "ME WO MBike3"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "MOTORBIKE 4" Then stDocName = "ME WO MBike4"
If Me![Project Name] = "WRITE OFF" And Me![Category] = "TRAILER" Then stDocName = "ME WO Trailer"

DoCmd.OpenForm stDocName, acNormal
If Me![Our Reference] = Nz(DMax("Me![Our Reference]", Me![Form].[RecordSource]), 0) Then
DoCmd.GoToRecord , , acNewRec
End If

ElseIf Me![Project Name] <> "REPAIR" Or Me![Project Name] <> "WRITE OFF" Or Me![Project Name] <> "HAIL DAMAGE" Or Me![Project Name] <> "HAIL DAMAGE AND ACCIDENT" Or Me![Project Name] <> "HOLLARD" Then
If Me![Project Name] = "COMMERCIAL" And Me![Category] = "COMMERCIAL" Then stDocName = "COMMERCIAL.doc"
If Me![Project Name] = "COMMERCIAL TRAILER" And Me![Category] = "COMMERCIAL TRAILER" Then stDocName = "COMMERCIAL TRAILER.doc"
If Me![Project Name] = "DEFFECTIVE WORKMANSHIP" And Me![Category] = "DEFFECTIVE WORKMANSHIP" Then stDocName = "DFW.doc"
If Me![Project Name] = "GOODS IN TRANSIT" And Me![Category] = "GOODS IN TRANSIT" Then stDocName = "GIT.doc"
If Me![Project Name] = "INVESTIGATION" And Me![Category] = "INVESTIGATION" Then stDocName = "INVESTIGATION.doc"
If Me![Project Name] = "MARINE SML CRAFT" And Me![Category] = "MARINE SML CRAFT" Then stDocName = "MARINE SML CRAFT.doc"
If Me![Project Name] = "MARINE MOTOR" And Me![Category] = "MARINE MOTOR" Then stDocName = "MARINE MOTOR.doc"
If Me![Project Name] = "PLANT" And Me![Category] = "PLANT" Then stDocName = "PLANT.doc"
If Me![Project Name] = "TRUCK, TRAILER AND GIT" And Me![Category] = "TRUCK, TRAILER AND GIT" Then stDocName = "TTGIT.doc"
If Me![Project Name] = "VALUATION" And Me![Category] = "VALUATION" Then stDocName = "VALUATION.doc"

Documents.Open FileName:="\\MWAssessing\WordDocs\stDocName", ReadOnly:=True

End If

Exit_cmdCreateMEReport_Click:
Exit Sub

Err_MEReport_Report_Click:
MsgBox "Please make sure you have selected a valid Claim Report Type and Claim Type! For a Hollard Report please Click the Hollard Link Below"
Resume Exit_cmdCreateMEReport_Click

End Sub
It does not work and I need to train on this tomorrow.

Then there is the invoice
How do you copy code from one table to another based on a field or criterea.

If anyone can help with these two issues I would be grateful.

Thank you
Kim

EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Pattern
http://www.eggheadcafe.com/tutorial...b-7374d3da3425/wpf-and-the-model-view-vi.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top