So have just been asked to take a look at an access database that has been dropped on someone who is not particularly access-literate.
They asked me to add the subtotal values, VAT and Total into the word document that gets generated when they click the Crete invoice button. Now I worked on this last night and had it working, when that create invoice button was pressed a word document would open with all the details in it pulled out from access.
However this morning they have come in and told me it doesnt work, I check and lo and behold it doesnt. All the changes I made are still there and it should work. I go to the record that I know I tested last night and it does work
So now I am confused. The record that does work is in the same table as the ones that dont, and the form is the same in each case. What could possibly be the problem?
A little more detail. I cant just go posting the whole thing as its confidential but basically there is a form what has order details on it along with customer details and pricing which is pulled out of a few tables
So the field InvTot1 & VAT & InvTotNew are what should be being pulled into word, the VBA script behind it is
Oh and the rest of the bookmarks work fine for all records. but the 3 mentioned only work on a certain record
They asked me to add the subtotal values, VAT and Total into the word document that gets generated when they click the Crete invoice button. Now I worked on this last night and had it working, when that create invoice button was pressed a word document would open with all the details in it pulled out from access.
However this morning they have come in and told me it doesnt work, I check and lo and behold it doesnt. All the changes I made are still there and it should work. I go to the record that I know I tested last night and it does work
So now I am confused. The record that does work is in the same table as the ones that dont, and the form is the same in each case. What could possibly be the problem?
A little more detail. I cant just go posting the whole thing as its confidential but basically there is a form what has order details on it along with customer details and pricing which is pulled out of a few tables
So the field InvTot1 & VAT & InvTotNew are what should be being pulled into word, the VBA script behind it is
Code:
Public Function PrintInvoice() On Error GoTo Err_PrintInvoice Set gdb = CurrentDb() Set grst = gdb.OpenRecordset("qryJob", dbOpenDynaset) CreateWordObj gLocation = gDocumentLocation & "Document Templates\Invoice invoice.dot" ' PrintInit 'Header Detail With gobjWord .Selection.GoTo wdGoToBookmark, Name:="CompanyName" If Not IsNull(grst![Company Name]) Then .Selection.TypeText grst![Company Name] End If .Selection.GoTo wdGoToBookmark, Name:="Address1" If Not IsNull(grst![Address1]) Then .Selection.TypeText grst![Address1] End If .Selection.GoTo wdGoToBookmark, Name:="Address2" If Not IsNull(grst![Address2]) Then .Selection.TypeText grst![Address2] End If .Selection.GoTo wdGoToBookmark, Name:="Town" If Not IsNull(grst![Town]) Then .Selection.TypeText grst![Town] End If .Selection.GoTo wdGoToBookmark, Name:="County" If Not IsNull(grst![County]) Then .Selection.TypeText grst![County] End If .Selection.GoTo wdGoToBookmark, Name:="PostCode" If Not IsNull(grst![Postcode]) Then .Selection.TypeText grst![Postcode] End If .Selection.GoTo wdGoToBookmark, Name:="CustRef" If Not IsNull(grst![Customer Order Reference]) Then .Selection.TypeText grst![Customer Order Reference] End If .Selection.GoTo wdGoToBookmark, Name:="OurRef" If Not IsNull(grst![OrderID]) Then .Selection.TypeText grst![OrderID] End If .Selection.GoTo wdGoToBookmark, Name:="DocDate" .Selection.TypeText Date .Selection.GoTo wdGoToBookmark, Name:="OrderId" If Not IsNull(grst![InvNumb]) Then .Selection.TypeText grst![InvNumb] End If ' Line Detail .Selection.GoTo wdGoToBookmark, Name:="JobTitle" If Not IsNull(grst![Job Title]) Then .Selection.TypeText grst![Job Title] End If .Selection.GoTo wdGoToBookmark, Name:="Qty" If Not IsNull(grst![Quantity]) Then .Selection.TypeText grst![Quantity] End If .Selection.GoTo wdGoToBookmark, Name:="OrigQuote" If Not IsNull(grst![Origquote]) Then .Selection.TypeText grst![Origquote] End If .Selection.GoTo wdGoToBookmark, Name:="AddInv1" If Not IsNull(grst![AddInv1]) Then .Selection.TypeText grst![AddInv1] End If .Selection.GoTo wdGoToBookmark, Name:="AddInv2" If Not IsNull(grst![AddInv2]) Then .Selection.TypeText grst![AddInv2] End If .Selection.GoTo wdGoToBookmark, Name:="For1" If Not IsNull(grst![For1]) Then .Selection.TypeText grst![For1] End If .Selection.GoTo wdGoToBookmark, Name:="For2" If Not IsNull(grst![For2]) Then .Selection.TypeText grst![For2] End If .Selection.GoTo wdGoToBookmark, Name:="InvTot1" If Not IsNull(grst![InvTot1]) Then .Selection.TypeText grst![InvTot1] End If .Selection.GoTo wdGoToBookmark, Name:="VAT" If Not IsNull(grst![VAT]) Then .Selection.TypeText grst![VAT] End If .Selection.GoTo wdGoToBookmark, Name:="InvTotNew" If Not IsNull(grst![InvTotNew]) Then .Selection.TypeText grst![InvTotNew] End If 'Total detail .Visible = True End With ' gobjWord.ActiveDocument.PrintOut Background:=False gobjWord.ActiveDocument.PrintPreview ' gobjWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges CloseWord PrintInvoice_Exit: Exit Function Err_PrintInvoice: MsgBox Err.Number & "-" & Err.Description Resume PrintInvoice_Exit End Function
Comment