To Jon Vinson

A

Aurora

Good Morning - first of all THANK YOU very much for your answer to my
"Stopping an automatic save" question on 1/30/07. (I am making changes to a
Db that I did not create). Your instructions were very clear and easy to
follow and it works beautifully.

Now I want to know if I can do the same thing with a Save Macro/button. On
the form is a SAVE button that I know everyone is using. Right now people
will click on the SAVE button and think their work is saved until they try to
get out of the screen or go to another record. That is when the message
comes up. Please let me know if this is possible or not? If it is - how can
I do this?

Again thank you very much for your previous help - Aurora
 
J

John Vinson

Good Morning - first of all THANK YOU very much for your answer to my
"Stopping an automatic save" question on 1/30/07. (I am making changes to a
Db that I did not create). Your instructions were very clear and easy to
follow and it works beautifully.

Now I want to know if I can do the same thing with a Save Macro/button. On
the form is a SAVE button that I know everyone is using. Right now people
will click on the SAVE button and think their work is saved until they try to
get out of the screen or go to another record. That is when the message
comes up. Please let me know if this is possible or not? If it is - how can
I do this?

Again thank you very much for your previous help - Aurora

Please open this form in design view, view the properties of this
button, and tell me what is in the button's Click event. If it's a
macro post the steps of the macro; if it shows [Event Procedure] click
the ... button by it and post the VBA code. Since I don't know what
the SAVE button is doing, it's a bit hard to suggest how to fix it!

John W. Vinson[MVP]
 
A

Aurora

Thank you Jon: This is what I did.

Private Sub Save_Record_Click()
On Error GoTo Err_Save_Record_Click
Dim iAns As Integer
iAns = MsgBox("Is this information correct and ready to be saved?", vbYesNo)
If iAns = vbNo Then
Trueline: Me.Undo
Cancel = True
End If

Now I am getting an error. The "Cancel =" is highlighted in blue.
The error says - "Compile Error. Can't find project or library."
What do I do now?
Aurora


End Sub

John Vinson said:
Good Morning - first of all THANK YOU very much for your answer to my
"Stopping an automatic save" question on 1/30/07. (I am making changes to a
Db that I did not create). Your instructions were very clear and easy to
follow and it works beautifully.

Now I want to know if I can do the same thing with a Save Macro/button. On
the form is a SAVE button that I know everyone is using. Right now people
will click on the SAVE button and think their work is saved until they try to
get out of the screen or go to another record. That is when the message
comes up. Please let me know if this is possible or not? If it is - how can
I do this?

Again thank you very much for your previous help - Aurora

Please open this form in design view, view the properties of this
button, and tell me what is in the button's Click event. If it's a
macro post the steps of the macro; if it shows [Event Procedure] click
the ... button by it and post the VBA code. Since I don't know what
the SAVE button is doing, it's a bit hard to suggest how to fix it!

John W. Vinson[MVP]
 
D

Douglas J. Steele

Remove the line

Cancel = True

from your code.

If your code were in a BeforeUpdate event, it would be required. However,
there is no Cancel argument in Click events.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Aurora said:
Thank you Jon: This is what I did.

Private Sub Save_Record_Click()
On Error GoTo Err_Save_Record_Click
Dim iAns As Integer
iAns = MsgBox("Is this information correct and ready to be saved?",
vbYesNo)
If iAns = vbNo Then
Trueline: Me.Undo
Cancel = True
End If

Now I am getting an error. The "Cancel =" is highlighted in blue.
The error says - "Compile Error. Can't find project or library."
What do I do now?
Aurora


End Sub

John Vinson said:
Good Morning - first of all THANK YOU very much for your answer to my
"Stopping an automatic save" question on 1/30/07. (I am making changes
to a
Db that I did not create). Your instructions were very clear and easy
to
follow and it works beautifully.

Now I want to know if I can do the same thing with a Save Macro/button.
On
the form is a SAVE button that I know everyone is using. Right now
people
will click on the SAVE button and think their work is saved until they
try to
get out of the screen or go to another record. That is when the message
comes up. Please let me know if this is possible or not? If it is -
how can
I do this?

Again thank you very much for your previous help - Aurora

Please open this form in design view, view the properties of this
button, and tell me what is in the button's Click event. If it's a
macro post the steps of the macro; if it shows [Event Procedure] click
the ... button by it and post the VBA code. Since I don't know what
the SAVE button is doing, it's a bit hard to suggest how to fix it!

John W. Vinson[MVP]
 
J

John Vinson

Now I am getting an error. The "Cancel =" is highlighted in blue.
The error says - "Compile Error. Can't find project or library."
What do I do now?

Put the code in the Form's BeforeUpdate event (which does have a
Cancel argument) rather than in the button's Click event (which
doesn't).

The BeforeUpdate event will fire no matter HOW the user chooses to
save the record - whether from the button, or closing the form, using
the Records menu option, whatever.

Juat a note: having this kind of verification ("do you really want to
save?") gets annoying to users over a rather short time, and ceases to
be effective; users will just blindly click Yes... and THEN realize
"oops I didn't want to do that". Good luck.

John W. Vinson[MVP]
 
Top