[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

Need a "confirm change" dialogue when editing MS Access form field

Hi All,
Basically my boss wants an added level of proetection from careless people changing part numbers and quantities in his electronics parts database. So this has to apply to only two fields in the form.

We need a dialogue box to pop up when the user changes the contents of a form field, preferably when they move to the next field or record. There are two special needs here that prevent me from using the "After Update" event in the Properties panel and then building a macro that pops up a Msgbox warning:

1)  It can't happen with new records - it can only occur when the user goes back and makes a change to an existing record with the "Qty" and "Mfg Part Number" fields already filled out
2)  They want the pop-up warning box to say "Are you sure you want to make changes". (Y)es and (N)o keyboard stroke must work in conjunction with the warning box. (Y)es would allow the user to continue to the next field or record.....(N)o would just stay in the field

My utmost appreciation to anybody who can make this work, and explain generally how to apply it to the field.

Thanks
0
hiviper
Asked:
hiviper
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
In the Qty and 'Mfg Part Number' BeforeUpdate event...

Private Sub ThatFieldName_BeforeUpdate(Cancel as Integer)

'If it's a new record, bail here.
If Me.NewRecord then exit sub

'Make sure user entered a value, else bail.
If Nz(Me.ThatFieldName, "") = "" then exit sub

Select Case msgbox("Are you sure you want to make changes", vbYesNo, "A title goes here")
  Case vbYes
     'Make the change code here
  Case vbNo
     'User cancelled the change.  Do nothing
     Cancel = True
End Select
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now