Hi,
I've just encountered (and solved) the weirdest problem.
I have a button on a form that performs this:
- Prints a report pertaining to that record
- Sets a boolean field to true
- Saves record using this line of code:
If Me.Dirty Then RunCommand acCmdSaveRecord
- prints same report again (form will show "Copy").
Works perferctly, never any problem.
One of my users just installed a new printer (HP laserjet P2055DN) and now the saverecord mysteriously fails, without an error message!
After changing the printer driver to one for a slightly older model, everything is back to normal again.
What the &$^&# is going on here?
Printer driver prevents record save
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
-
- Administrator
- Posts: 78789
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Printer driver prevents record save
Strange! The report did get printed twice with the newer printer driver?
Best wishes,
Hans
Hans
-
- Microsoft MVP
- Posts: 656
- Joined: 24 Jan 2010, 17:51
- Status: Microsoft MVP
- Location: Weert, The Netherlands
Re: Printer driver prevents record save
Odd thing is, the field DOES get updated, but the form's Dirty property stays true after the record save (which is when I throw the error). The relevant code is:
Code: Select all
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
End If
If Me.Dirty Then
'Record changes have not been saved!
MsgBox "Wijzigingen in record niet opgeslagen; afdrukken geannuleerd!", vbExclamation + vbOKOnly, "Wijzigingen niet opgeslagen"
Exit For
Else
' other code goes here, e.g. print the form
-
- Administrator
- Posts: 78789
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Printer driver prevents record save
It's hard to see how a printer driver could affect this!
Is an error handler active when this code is executed, or do you happen to have
On Error Resume Next
above this code?
Is an error handler active when this code is executed, or do you happen to have
On Error Resume Next
above this code?
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 331
- Joined: 11 Feb 2010, 03:55
- Location: Land O Lakes, FL
Re: Printer driver prevents record save
My first question is "Why would you first print the report WITHOUT saving the record?". It seems to me the order of your code should be:
- Save record (if dirty)
- Print report
- set flag
- Print report
And I agree with Hans, I don't see how the Printer Driver could affect this.
- Save record (if dirty)
- Print report
- set flag
- Print report
And I agree with Hans, I don't see how the Printer Driver could affect this.
Mark Liquorman
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.
Land O Lakes, FL
see my website http://www.liquorman.net for Access Tips and Tricks, and for my Liquorman Utilities.