Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read-only/update form problems

Status
Not open for further replies.

Phil4tektips

Technical User
Jul 18, 2005
89
GB
Hello all,

I have a form which user's can open as a read-only form or as an update form depending which button they use to access the form.

The read-only version:
DoCmd.OpenForm stDocName, , , , acFormReadOnly

The update version:
DoCmd.OpenForm stDocName, , , stLinkCriteria

I have a Print command button on the form. This prints out a report of the information contained in the form. This works fine until an update is made.

If the user makes an update then clicks the Print button then the old information is printed since there has not been a save. So I put a save command in before the line of code for the printing, this then worked and printed the current data.

However the Read-Only version of the form now wont allow the user to use the button as a read only form doesnt allow save commands to be carried out.

Really I want an If Statement around the save command determining if they are in the read-only form or the update version. What is the condition that i need to use?

Many thanks,

~Phil4tektips~
Grant us peace in our days work!
 
Hi

"However the Read-Only version of the form now wont allow the user to use the button as a read only form doesnt allow save commands to be carried out."

why not change your VBA code to test for read only?, something like

If Me.ReadOnly Then
Else
DoCmd.RunCommand acCmdSaveREcord
End If
DoCmd.OpenReport ...blah

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Test the Dirty property of the Form object:
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top