473,770 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing from one form to the next

AccessIdiot
493 Contributor
I feel really dumb asking this but I'm not sure why it isn't working.

I have a form that has a text field. You type a number into the text field, it gets concatenated with a string, then gets put into the table as a string in the field "Survey_Num ".

Press a button on the form and another form pops up. There is a "Survey_Num " field in the table behind this form as well and they are tied in a one-to-many relationship.

I want the value on the first form to show up in the field on the 2nd form.

I am guessing that it is not showing up because technically the value hasn't entered the table from the first form.

How do I force Access to enter the data when I press the button to go to the second form? I've tried using a close command to close the first form when the 2nd form is opening, thinking that will enter the info into the table but no dice.

Seems simple but I am stumped - any ideas?

Any code I can provide?

Form 1 = frm_Survey with unbound field txt_SurveyNum where user enters an integer and invisible field txt_SurveyNumID that is bound to Survey_Num of Survey table.

txt_SurveyNum has LostFocus event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txt_SurveyNum_LostFocus()
  2.     Me.txt_SurveyNumID = Me.OpenArgs & Me.txt_SurveyNum
  3. End Sub
The OpenArgs is passed by another form that opens frm_Survey.

Form 2 = frm_Replicate with Survey_Num field and control source is field of same name in table. Because it is in a relationship with the field of same name in the other table I didn't think I'd have to put any special query or code on it?

thanks in advance for any help!
melissa
Mar 8 '07 #1
16 1808
Rabbit
12,516 Recognized Expert Moderator MVP
Hmm, it might be because the field is invisible. I'm not sure as I haven't tested this but before you assign the value in the Lost Focus event, try making it visible, assign the value, and then make it invisible again.
Mar 8 '07 #2
AccessIdiot
493 Contributor
I tried everything with the field visible but it doesn't show up on the 2nd form.
Mar 8 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Are you trying to pass the concatenated string to yet another form?
Mar 8 '07 #4
AccessIdiot
493 Contributor
Yes. Sort of. I would expect that since they are linked (Survey_Num is primary key of Survey table and foreign key in Replicate table) it would show up simply by being bound. Sorry, let me expand.

I have a switchboard with 3 buttons. Each button opens the same form but passes a different string via the OpenArgs option of the Open command. For example,
Expand|Select|Wrap|Line Numbers
  1.  stDocName = "frm_Survey"
  2.     DoCmd.OpenForm stDocName, , , , , , "TR"
.

On frm_Survey is the unbound textbox "txt_SurveyNum" . The user enters a number there ("3"). Then on the hidden/invisible bound textbox ("txt_SurveyNum ID") is the LostFocus event that concatenates the TR with 3 to make TR3. This is the value that is entered in the Survey_Num field of tbl_Survey.

frm_Survey has a button to open frm_Replicate. On the form is a bound textbox called "txt_SurveyNum" . It is bound to the field Survey_Num on tbl_Replicate, which is acting as a foreign key to the Survey_Num field on tbl_Survey.

My hope is that when frm_Replicate is opened the value "TR3" shows up in the textbox that is bound to Survey_Num.

I hope this makes sense!
Mar 8 '07 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Yes. Sorry, let me expand.

I have a switchboard with 3 buttons. Each button opens the same form but passes a different string via the OpenArgs option of the Open command. For example,
Expand|Select|Wrap|Line Numbers
  1.  stDocName = "frm_Survey"
  2.     DoCmd.OpenForm stDocName, , , , , , "TR"
.

On frm_Survey is the unbound textbox "txt_SurveyNum" . The user enters a number there ("3"). Then on the hidden/invisible bound textbox ("txt_SurveyNum ID") is the LostFocus event that concatenates the TR with 3 to make TR3. This is the value that is entered in the Survey_Num field of tbl_Survey.

frm_Survey has a button to open frm_Replicate. On the form is a bound textbox called "txt_SurveyNum" . It is bound to the field Survey_Num on tbl_Replicate, which is acting as a foreign key to the Survey_Num field on tbl_Survey.

My hope is that when frm_Replicate is opened the value "TR3" shows up in the textbox that is bound to Survey_Num.

I hope this makes sense!
When you open the form you're going to have to assign the concatenated variable.
Expand|Select|Wrap|Line Numbers
  1.  stDocName = "frm_Replicate"
  2.     DoCmd.OpenForm stDocName
  3.     Forms!frm_Replicate!Survey_Num = Me.Survey_Num
  4.     DoCmd.Close acForm, "frm_Survey"
Mar 8 '07 #6
AccessIdiot
493 Contributor
When you open the form you're going to have to assign the concatenated variable.
Expand|Select|Wrap|Line Numbers
  1.  stDocName = "frm_Replicate"
  2.     DoCmd.OpenForm stDocName
  3.     Forms!frm_Replicate!Survey_Num = Me.Survey_Num
  4.     DoCmd.Close acForm, "frm_Survey"

Ahh! That works great! Can you explain to me what this line means?
Expand|Select|Wrap|Line Numbers
  1. Forms!frm_Replicate!Survey_Num = Me.Survey_Num
I assume it means that Survey_Num on frm_Replicate equals Surevy_Num on the current (frm_Survey) form?

Moving forward . . . on frm_Replicate I have a button to add a new record (I am going to disable the the standard Access built-in buttons on the form to really "dumb it down" for the user). How can I carry the value again to the next record? Basically I need to keep carrying "TR3" until the user hits the button to stop adding Replicates, closes it and goes back to frm_Survey to start a new Survey ("TR4").
Mar 9 '07 #7
Rabbit
12,516 Recognized Expert Moderator MVP
Ahh! That works great! Can you explain to me what this line means?
Expand|Select|Wrap|Line Numbers
  1. Forms!frm_Replicate!Survey_Num = Me.Survey_Num
I assume it means that Survey_Num on frm_Replicate equals Surevy_Num on the current (frm_Survey) form?

Moving forward . . . on frm_Replicate I have a button to add a new record (I am going to disable the the standard Access built-in buttons on the form to really "dumb it down" for the user). How can I carry the value again to the next record? Basically I need to keep carrying "TR3" until the user hits the button to stop adding Replicates, closes it and goes back to frm_Survey to start a new Survey ("TR4").
Yes, that's exactly what it means.

In this case, rather than assigning the Survey_Num directly from the original form, pass it as in OpenArgs.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frm_Replicate",,,,,, Me.Survey_Num
Then in the on open of the form and when they click the new button, you can have it assign Me.OpenArgs to Me.Survey_Num.
Mar 9 '07 #8
AccessIdiot
493 Contributor
Okay, so switch the code around a bit? Let me try that . . .
Mar 9 '07 #9
Rabbit
12,516 Recognized Expert Moderator MVP
That's right, let us know how you get along.
Mar 9 '07 #10

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

Similar topics

5
5942
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page contains: <?php $_SESSION = ""; $_SESSION = "";
1
7789
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
3
8741
by: Mike | last post by:
I have a mulitpage form that I do not record the information into a dbase until the end. I need to pass the field values form on form to the next. I have the code for automatically generating the 'hidden fields' but cannot figure out how to code it to automatically generate the assignment statements. For example:
3
3648
by: Jason | last post by:
Hi folks, I'm trying to create a section of a website with a unique file upload utility. The problem is that in most code and components I find to pass multipart/form data, you need to know the number of files specified to upload. I'm trying to solve this by having one INPUT TYPE=FILE box, and, using javascript, each time someone selects a file, it populates one listbox below it. Once the submit button is pressed, I'm sending the...
3
3463
by: Kim Lots | last post by:
Hi all I'm trying to pass two variables, but what is wrong with my code? -------- <form name="uno" action="validate.asp?Num=<%=Request.Querystring("Num") %>" method="post"> <textarea name="komm" cols="90" rows="4" id="komm"></textarea>
3
1572
by: Lee | last post by:
Hi All How can I pass options from one webpage into another webpage. When the user clicks on the hyperlink I want them to be go to the next page but I need to pass in a number that the next page needs to reference. Thanks Lee
2
1303
by: Thomas Beyerlein | last post by:
Hello, I am trying to build a UI and I need the user to go though about 4 forms making decisions and then passing the decision to the next form. Finally on the last form I need all the answers to open the next and final form, which there are 16 different ways to go. So I thought by putting the decisions in an array, and passing it to each form. I get this error-: Value of type '1-dimensional array of String' cannot be converted to...
13
2520
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On Error GoTo err_zoom strFormName = formName
0
1544
by: Magnus Bergh | last post by:
I am developing an application for pocketpc and this involvs a but of juggling with different forms. I have an "order entry" type of application. On the main form I have a grid which displays Order headers. Let call this form "OrderList" From this view I edit/enter new orders by opening a new form for entering data. This is done using (more or less) the designer generated forms, so I have a "Order edit view dialog. I pass the binding...
6
1543
by: gggram2000 | last post by:
I'd like to know how I go about passing two variables from one form to the next. For example, I can pass a variable like this: This demonstrates how to pass a variable to a form when the form is opened. private void OpenForm_Click(object sender, System.EventArgs e) { // Get the value to be passed string parentValue = this.UserResponse.Text; // Create the child form and pass the value in the constructor
0
9618
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
9454
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
10259
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
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.