V
Veus
Hi,
I have a data entry form which has a submit button.
When a user clicks this submit button i need the form to open a report
with the newly entered data and close the form.
This is what ive got so far:
Me.Dirty = False
Dim strReportName As String
Dim strCriteria As String
strReportName = "bookingLetter"
strCriteria = "[bookingsID]= " & Me.ID & ""
'DoCmd.Close
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
The error is that the report comes up blank, the report actually
appears but the fields show '#Error', i assume this is because the data
on the form isnt being saved before the report opens (so Me.ID isnt in
the database yet, hence no records)
As you can see i have tried to get round this by forcing a save
(Me.Dirty = False) as well as closing the form before opening the
report.
I have also tried placing the open report code in the Form_AfterUpdate
function however it is the same.
Can anyone shed any light on this?
I have a data entry form which has a submit button.
When a user clicks this submit button i need the form to open a report
with the newly entered data and close the form.
This is what ive got so far:
Me.Dirty = False
Dim strReportName As String
Dim strCriteria As String
strReportName = "bookingLetter"
strCriteria = "[bookingsID]= " & Me.ID & ""
'DoCmd.Close
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
The error is that the report comes up blank, the report actually
appears but the fields show '#Error', i assume this is because the data
on the form isnt being saved before the report opens (so Me.ID isnt in
the database yet, hence no records)
As you can see i have tried to get round this by forcing a save
(Me.Dirty = False) as well as closing the form before opening the
report.
I have also tried placing the open report code in the Form_AfterUpdate
function however it is the same.
Can anyone shed any light on this?