473,616 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Form instead of message box

RC
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.
Nov 13 '05 #1
7 2250
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was
clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.

Nov 13 '05 #2
RC
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was
clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.

Nov 13 '05 #3
You're close.
I think I'd write the code more like this:

select case Forms!myPopupDi alogForm.Active Control.name
case "MakeChange s "
rs.update
case "DontMakeChange s"
Me.Undo
End select

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message

news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.

Nov 13 '05 #4
RC
OK, I got the code below to work, but, let's say the codes jumps to
the MakeChangesLine : and you edit and update the record THEN the code
continues along and skips over the DontMakeChanges Line: line and then
executes the next line of code which is form.undo
I don't understand how to use the "goto" statement, is there a way to
write this so it doesn't execute the form.undo line?
-----------------------
Dim ctlCurrentContr ol As Control
Set ctlCurrentContr ol = Forms!DisplayIt emInformationFo rm.ActiveContro l

If ctlCurrentContr ol.Name = "ChangeDataButt on" Then
GoTo MakeChangesLine :
If ctlCurrentContr ol.Name = "DontChangeData Button" Then
GoTo DontMakeChanges Line:

MakeChangesLine :
this is where I edit and update the record

DontMakeChanges Line:
form.undo
rc*********@yah oo.com (RC) wrote in message news:<3c******* *************** ****@posting.go ogle.com>...
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was
clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.

Nov 13 '05 #5
RC
Should I use Select Case instead of goto?

rc*********@yah oo.com (RC) wrote in message news:<3c******* *************** ****@posting.go ogle.com>...
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was
clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
When I am adding records to a database and each record is unique by
the Serial Number. I would like to step through my code adding
records unless the Serial Number already exists in the database. If
the record already exits, then I would like to pop up a form, in
pop-up, dialog mode. The form will ask if the user wants to make
changes to the existing record and go back to the form and not make
any changes. The code stops because the pop up form is "dialog" but I
want to return to a certain line in the code depending which button
the user selected on the pop-up form or somehow react to which button
the user picked on the pop-up form not just return and continue
processing the code where it left off.

Nov 13 '05 #6
The answer to "Should I use <anything> instead of GoTo?" is generally "yes",
with the possible exception of error handling.

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
Should I use Select Case instead of goto?

rc*********@yah oo.com (RC) wrote in message

news:<3c******* *************** ****@posting.go ogle.com>...
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
> When I am adding records to a database and each record is unique by
> the Serial Number. I would like to step through my code adding
> records unless the Serial Number already exists in the database. If
> the record already exits, then I would like to pop up a form, in
> pop-up, dialog mode. The form will ask if the user wants to make
> changes to the existing record and go back to the form and not make
> any changes. The code stops because the pop up form is "dialog" but I > want to return to a certain line in the code depending which button
> the user selected on the pop-up form or somehow react to which button > the user picked on the pop-up form not just return and continue
> processing the code where it left off.

Nov 13 '05 #7
RC
THANKS !! It worked like a charm! When I typed the Select Case line
and I got to the period after "ActiveControl" , I thought I was only
able to use the choices presented in the VB Editor drop down box, but
even though "name" was not one of the options, it worked fine.

"MacDermott " <ma********@nos pam.com> wrote in message news:<Ar******* **********@news read2.news.atl. earthlink.net>. ..
You're close.
I think I'd write the code more like this:

select case Forms!myPopupDi alogForm.Active Control.name
case "MakeChange s "
rs.update
case "DontMakeChange s"
Me.Undo
End select

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
Thanks for the reply, is this the way to do what you are saying?

If the user clicks on the "MakeChange s" Button or the
"DontMakeChange s" Button, I have the onclick property for those
buttons change the popup dialog form to invisible, then my code
resumes where I left off, but, at that point I put a line of code
like:

If Forms!myPopupDi alogForm.Active Control = MakeChanges then goto line
22
End If

If Forms!myPopupDi alogForm.Active Control = DontMakeChanges then goto
line 33
EndIf

Line 22
rs.update

Line 33
Form.Undo

"MacDermott " <ma********@nos pam.com> wrote in message

news:<TO******* **********@news read2.news.atl. earthlink.net>. ..
Remove the X in the upper right of your dialog (that's the CloseButton
property of the form), so the user must select one of your buttons.
In the code behind those buttons, don't close the dialog -
set its Visible property to False instead.
Code execution will resume on your main form right after your
DoCmd.OpenForm.
You can check your dialog's ActiveControl property to see which button was clicked, and branch accordingly.

HTH
- Turtle

"RC" <rc*********@ya hoo.com> wrote in message
news:3c******** *************** ***@posting.goo gle.com...
> When I am adding records to a database and each record is unique by
> the Serial Number. I would like to step through my code adding
> records unless the Serial Number already exists in the database. If
> the record already exits, then I would like to pop up a form, in
> pop-up, dialog mode. The form will ask if the user wants to make
> changes to the existing record and go back to the form and not make
> any changes. The code stops because the pop up form is "dialog" but I
> want to return to a certain line in the code depending which button
> the user selected on the pop-up form or somehow react to which button
> the user picked on the pop-up form not just return and continue
> processing the code where it left off.

Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3150
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access the code variable that are supposed to be linked to the contained controls. It runs fines when everything is contained in a single web form project. What do I need to do to make it work from a class library?
1
3117
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created elements and would like to seek a solution for this. I had looked through several articles for accessing programatically-created dynamic elements such as: 1)
9
3137
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the other page, or is there something else like a stream which will be like a file. I am attempting to get a way from writing out a file and then having to give the page that I am posting to the file name. Instead I would like to just from asp.net...
4
3399
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
10
5033
by: Rick Palmer | last post by:
I have an app I'm working on that will allow a user to run one of 5 reports. The report names are in a combobox on my form. I have a sub defined for each report that has the exact same name as is displayed in the combobox. I have one button on the form to start processing. What I want to do is this: When the user selects the report they want to run from the combobox, I want to dynamically bind the appropriate sub to the button's click...
5
3069
by: RichG | last post by:
I'm looking for a way to bring an open form to the top. I know that is I open a form directly with form1.show() and then later, while the form is open I do another form1.show(), that I will get original form to pop to the top. But because I want to have multiple instances of form1 open, I open it with dim frm as new form1 frm.show() What I need to do now is reference the opened form from another window and even pop it to the top if I...
6
2145
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is called when the form is loaded. this.Load += new System.EventHandler(this.dataBoundGridForm_Load); I mean if I compare form load with the C-tor I think that it's enough to put the code into the C-tor instead
0
2743
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) To map "Keys" objects to their string constant, and stored them on a string Queue as they were happening. Then (after resetting the form), I simulate replaying of these actions by flushing the queued...
21
34379
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
0
8203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8146
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6097
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4063
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2579
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.