Open Report using criteria in a field column

sashapixie

Registered User.
Local time
Today, 08:16
Joined
Sep 30, 2015
Messages
27
SOLVED: Open Report using criteria in a field column

Hi There,

I have the following code which opens a report from a button in a form.

Private Sub CmbBookOrder_Click()
Set rsTrans = Me.Inventory_Transactions_Orders_subform.Form.Recordset
Set rsBDate = Me.Inventory_Transactions_Orders_subform.Form.Recordset
Me.Status_ID = Me.Status_ID.ItemData(1)
With rsTrans
.MoveFirst
Do While Not rsTrans.EOF
.Edit
rsTrans![Transaction Type] = Me.Inventory_Transactions_Orders_subform.Form.Transaction_Type.ItemData(1)
.Update
.MoveNext
Loop
End With
With rsBDate
.MoveFirst
Do While Not rsBDate.EOF
.Edit
rsBDate![Transaction Modified Date] = Date
.Update
.MoveNext
Loop
End With
'Me.Requery
CreateInvoice = MsgBox("Would you like to create an invoice?", vbYesNo)
If CreateInvoice = vbYes Then
DoCmd.OpenReport "UK Invoice", acViewPreview
DoCmd.Close acForm, "Order Entry Form", acSaveYes
DoCmd.Close acForm, "Main Menu", acSaveNo
DoCmd.Close acForm, "Login Form", acSaveNo
Else
End If
End Sub

I need to open the report EURO Invoice, UK Invoice or ROW Invoice based on the result in a column in my field.

The code to look up the field is Me.Customer_ID.Column (8) = UK, I have added this in as an IF and tested the above line of code to check vba is picking up the result which it is, I just cant run the code.

Any help is appreciated.
 
Last edited:
The value would need to be in quotes, like:

Me.Customer_ID.Column (8) = "UK"
 
The value would need to be in quotes, like:

Me.Customer_ID.Column (8) = "UK"

Thanks Paul, what can I say, it's been a long week :o
 
No problem, happens to us all.
 

Users who are viewing this thread

Back
Top Bottom