Automatic update of current record in multiuser enviorment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button that prints the current record in a report. But when you try to print all it prints out is a blank page. You have to either create a new record or go to another record and then go back to the one that you want to print in order for the button to work. It's like the record isn't being updated into the database for the button to work. Can you do an auto update when the button to print the report is pressed before the report is printed. This is the code that I have for the button and it works fine, I just need to do an update before it prints

Private Sub Command54_Click(
On Error GoTo Err_Command54_Clic

Dim strDocName As Strin
Dim strFilter As Strin

strDocName = "NonConformity Tag
strFilter = "Record_No = " & Forms![Inspection Data Entry Form]!Record_N
DoCmd.OpenReport strDocName, acViewNormal, , strFilte


Exit_Command54_Click
Exit Su

Thanks for the hel
Cha

Err_Command54_Click
MsgBox Err.Descriptio
Resume Exit_Command54_Clic

End Sub
 
If you have entered a new record (or edited an existing record) but not
saved the changes yet, clicking the button will not automatically save the
changes into the database - as you rightly suspect. You'll need to add a
statement to the button's Click event, to save the current changes (if any).
There are various statements you could use. For example:

runcommand accmdsaverecord
(or somesuch).

HTH,
TC


Chaz said:
I have a command button that prints the current record in a report. But
when you try to print all it prints out is a blank page. You have to either
create a new record or go to another record and then go back to the one that
you want to print in order for the button to work. It's like the record
isn't being updated into the database for the button to work. Can you do an
auto update when the button to print the report is pressed before the report
is printed. This is the code that I have for the button and it works fine, I
just need to do an update before it prints.
Private Sub Command54_Click()
On Error GoTo Err_Command54_Click

Dim strDocName As String
Dim strFilter As String

strDocName = "NonConformity Tag"
strFilter = "Record_No = " & Forms![Inspection Data Entry Form]!Record_No
DoCmd.OpenReport strDocName, acViewNormal, , strFilter


Exit_Command54_Click:
Exit Sub

Thanks for the help
Chaz

Err_Command54_Click:
MsgBox Err.Description
Resume Exit_Command54_Click

End Sub
 
Back
Top