473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Prompt for Saves to be Changed in Form

Hi - I have been using the code below to prompt users if they would like to add an order # to the database (save changes). It's working, but I need the text box to clear the information (and reset focus) in the Order# field so the user can input a new order # (if needed).

Private Sub ERROrderNumber_BeforeUpdate(Cancel As Integer)
Dim LResponse As Integer
Dim LMsg As String

LMsg = "Do you want to add a new order?"
LResponse = MsgBox(LMsg, vbYesNo, "Save Changes")

If LResponse = vbNo Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, acMenuVer70

End If

End Sub
Sep 8 '06 #1
3 2097
PEB
1,418 Expert 1GB
You need to use the command

Me!order # .Setfocus

to set the control to your order No

And

Me!Texbox=""

or

Me!Texbox=null

to clear Texbox
Sep 8 '06 #2
PEB - Thanks! But I'm still getting the following error:

You must save the field before you execute the GoToControl action, the GoToControl Method, or the SetFocus method. (Error #2108).
Sep 8 '06 #3
PEB
1,418 Expert 1GB
So You need to say

Cancel=true

after confirmation!

Private Sub ERROrderNumber_BeforeUpdate(Cancel As Integer)
Dim LResponse As Integer
Dim LMsg As String

LMsg = "Do you want to add a new order?"
LResponse = MsgBox(LMsg, vbYesNo, "Save Changes")

If LResponse = vbNo Then

Cancel=true

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, acMenuVer70

End If

End Sub
Sep 8 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Matthew | last post by:
I have a form that the user can edit data in. However, there are a couple of links on the page. The user can edit the data and click on a link, not submitting the form. Is there some code out...
13
by: JSE | last post by:
Hello everyone. here's what we have in an html file. <form ..... <input type=button name="comment" onclick=" prompt('enter comment',' ' )" > Is there anyway to get the value...
0
by: Laura Zeafla via .NET 247 | last post by:
I used the .NET forms application wizard. From the form youclick a button and it calls a C++ function through its dll. This function is supposed to pop-up a command prompt window. Something about...
7
by: Petesman | last post by:
I am trying to make a prompt that will ask the user for some input... If I just use var input = prompt("dafa") everything works fine but the box is put in the top left corner of the window. I need...
2
by: icedgar | last post by:
am using the following script in the BeforeUpdate area of a main form. Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strMsg As String strMsg = "Do you wish to save your changes?" If...
1
by: Aere | last post by:
Hello, I'm coding a program that saves information about my patients, so i created a rich textbox for every field. (Name, Tel, etc). The program saves a .txt for each field, no matter if there is...
4
by: ARC | last post by:
Hello all, I didn't use to have this problem in Access 97, but in 2007 (and maybe other versions of access after 97), if you have a form that has a subform, and you click the close button, you...
0
by: Ryan Liu | last post by:
I found DataGridView in .NET 2.0 has a bug, or maybe I used it in a wrong way, just try to confirm with you guys: I have a checkbox column in it, and a save button on the form try to save...
3
by: bollweevil | last post by:
Hello Everyone, I do Django web development on my Mac at home, and then I rsync the files with the Ubuntu web server. I want to write one single bash shell script that rsyncs the files and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.