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: - Private Sub txt_SurveyNum_LostFocus()
-
Me.txt_SurveyNumID = Me.OpenArgs & Me.txt_SurveyNum
-
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
16 1809
*with sheepish grin* what's the code for the Open form event?
I have this - Private Sub Form_Open(Cancel As Integer)
-
Me.Survey_Num = Me.OpenArgs
-
End Sub
but I get an error
also can you explain the difference between the form load event and the form open event?
Rabbit 12,516
Recognized Expert Moderator MVP
You'll have to put it in the On Load event.
On Open occurs when the form opens but before the first record is displayed.
On Load occurs when the form opens and after the first record is displayed.
So what's happening is that you're trying to assign the value to something that doesn't exist yet.
Thank you for the explanation. Now I have this on frm_Survey: - stDocName = "frm_Replicate"
-
DoCmd.OpenForm stDocName, , , , , , Me.Survey_Num
-
DoCmd.GoToRecord , , acNewRec
and this on frm_Replicate: - Private Sub Form_Load()
-
Me.Survey_Num = Me.OpenArgs
-
End Sub
-
-
Private Sub btnNewReplicate_Click()
-
On Error GoTo Err_btnNewReplicate_Click
-
-
DoCmd.GoToRecord , , acNewRec
-
Me.Survey_Num = Me.OpenArgs
-
-
Exit_btnNewReplicate_Click:
-
Exit Sub
-
-
Err_btnNewReplicate_Click:
-
MsgBox Err.Description
-
Resume Exit_btnNewReplicate_Click
-
-
End Sub
but I am getting an error message "Can't go to specified record"
Ugh I have to head home but I'll be back tomorrow!
Thanks for your help Rabbit, as always. :-)
I got it to work - thank you so much! This is what finally did it:
on frm_Survey - Private Sub txt_SurveyNum_LostFocus()
-
Me.txt_SurveyNumID = Me.OpenArgs & Me.txt_SurveyNum
-
End Sub
-
------------------------------------------------------------
-
Private Sub btn_AddReplicate_Click()
-
On Error GoTo Err_btn_AddReplicate_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "frm_Replicate"
-
DoCmd.OpenForm stDocName, , , , , , Me.Survey_Num
-
'DoCmd.GoToRecord , , acNewRec
-
-
DoCmd.Close acForm, "frm_Survey"
-
-
Exit_btn_AddReplicate_Click:
-
Exit Sub
-
-
Err_btn_AddReplicate_Click:
-
MsgBox Err.Description
-
Resume Exit_btn_AddReplicate_Click
-
-
End Sub
and on frm_Replicate: - Private Sub Form_Current()
-
Me.Survey_Num = Me.OpenArgs
-
End Sub
-
-------------------------------------------------
-
Private Sub btnNewReplicate_Click()
-
On Error GoTo Err_btnNewReplicate_Click
-
-
DoCmd.GoToRecord , , acNewRec
-
Me.Survey_Num = Me.OpenArgs
-
-
Exit_btnNewReplicate_Click:
-
Exit Sub
-
-
Err_btnNewReplicate_Click:
-
MsgBox Err.Description
-
Resume Exit_btnNewReplicate_Click
-
-
End Sub
I have continued questions about how to work backwards - to go from frm_Replicate back to frm_Survey and still have the 'TR' in the form but that's a question for a separate post when I get to it.
Thanks so much for all your help!
melissa :-)
Rabbit 12,516
Recognized Expert Moderator MVP
Glad you got it working. Sorry I didn't respond earlier, I just got into the office.
No worries. You know how satisfying it is when you finally figure out something yourself!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 = "";
|
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'>
|
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:
|
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...
|
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>
| |
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
|
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...
|
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
|
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...
|
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
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
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();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |