General discussion

Locked

Has a change occurred?

By john_wills ·
I allow editing on an Access form only when the user has specifically asked for it by clicking a button which sets AllowEdits=True. When she has finished editing she reverts to read-only mode and the update is effected by AllowEdits=False. I want toask her whether she actually wants the changes, and, if she does not, invoke DoMenuItem...acUndo, but if she has in the edit mode changed nothing there arises an error message. I would shield her from this. The obvious shield is a test whether therehas been any change, or whether an update is pending. How can I make such a test?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Has a change occurred?

by sl-campbell In reply to Has a change occurred?

Check the EditMode property value:

Me.RecordsetClone.EditMode

Poss. Values:
DbEditInProgress
dbEditNone
dbEditAdd

If by chance the recordset is not in edit mode when the field are changed (unbound controls) then you will need to set a variable (bPossibleSave) that is set to true once any of the fields on the form are changed using the change event (could also see what the status of the text box undo is)

Another way is to set an On Error Resume Next before you try to undo.


'**************************
By the way, concerning the other question you rejected and closed because you didn't see what I was proposing to do (Select Case in an SQL statement for SQL server):

The operanden the error was refering to was the = sign as I suggested. In an SQL Server select statement with a Case the syntax is (off the top of my head):

SELECT ColumnName =
CASE

END

So in your question:
SELECT CASE column
WHEN value1 THEN valueA
WHEN value2 THEN valueB
etc....
END

Would be written as:

SELECT column =
CASE
WHEN value1 THEN valueA
WHEN value2 THEN valueB
etc....
END


SELECT
CASE
WHEN column = value1 THEN valueA
WHEN column = value2 THEN valueB
etc....
END

Collapse -

Has a change occurred?

by Shanghai Sam In reply to Has a change occurred?

I eventually used the ON ERROR facility, a result perhaps of inadequate understanding of the underlying concepts of Access.
Your suggestion for CASE seems not to work, perhaps because my SELECT is subservient to INSERT. I may try the equationwithin the WHEN block. It looks cleaner than nested IIFs.

Collapse -

Has a change occurred?

by john_wills In reply to Has a change occurred?

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums