473,386 Members | 1,738 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,386 software developers and data experts.

Passing a value from one form to another

4
I have a main form which displays various text etc depending on the file number eg, DA314, DA315.
On the main form I have a button that opens up another form with a textbox in it. I want this text box to display the text that applies to that file number. Currently it opens on the first file and not the file that the form was opened from.

Any help please?
Aug 21 '07 #1
5 9796
Chose a field from the first form that is a unique identifier put this on the second form in the query for the second form for the U.I. put = Forms!The First Forms Name!The Name of the U.I. Then the second form should only be allowed to see the text that relates to the current record on the main form
Aug 21 '07 #2
ferg96
4
I am not sure what you mean. Where exactly do I put the code?

Thanks for the quick response
Aug 21 '07 #3
Ok from the strat you had to build tables and you must have made a primary Key this would be a unique identifier. Then I sure you created querys to biuld your forms off of if not make sure u do it would be in the critiria of the query that you would put the code this limits the query so that it only sees records where the Key field matches the key field on your main form. let me know if you need any more help
Aug 21 '07 #4
RobH
56
If this second form is only executed from the first form then you could even add to the "On Open" in Events the following

Expand|Select|Wrap|Line Numbers
  1.  
  2. Me.TextBoxOn2ndForm = [Forms]![TextBoxOn1stForm]
  3.  
  4.  
If the 2nd form is tied to a query then you could use the "Where" filter pass this is ideal for use with forms designed to gain search parameters for the next form.

On the first form when you do the

DoCmd.OpenForm "2ndForm"

You can add to it the options that apply a filter however if the Filter is complicated you should set the filter to a variable first.
the below allows for text before and after the Textbox entry - if you want a strick match then replace the Like with an = and remove the '* and *' from the strWhere line

Expand|Select|Wrap|Line Numbers
  1.  
  2. strWhere = "(((RecordNum) Like '*" & Me!TextBoxOn1stForm & "*')))"
  3.     DoCmd.OpenForm "2ndForm", , , strWhere
  4.  
  5.  
Aug 21 '07 #5
ferg96
4
Finally got it to work.

Thanks for your help!
Aug 21 '07 #6

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

Similar topics

2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
1
by: Al Jans | last post by:
Hi, I'm having a problem passing a value from a field on one form to another field on another form. The value is being passed between forms, however it's not being displayed and i've got no idea...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
13
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...
7
by: AMP | last post by:
Hello, I have this in form1: namespace Pass { public partial class Form1 : Form { public Form2 form2; public Form1() {
9
by: itarizin | last post by:
Today I found as ignorance owe me.. Let me explain what I'm tring to do and fail (fail: in my needs) For example, I've my stupid class: public class Hello { private int x = 0; public...
4
idsanjeev
by: idsanjeev | last post by:
SIR I AM PASSING VALUE FROM ONE FORM TO ANOTHER FORM THROUGH COOKIES BUT IS CAN ONLY TRANSFER LAST VALUE HOW CAN PASS VALUE AFTER CLICKIN ON LINK I AM USING THE CODE IS FOR LINK <td><a...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...
0
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,...
0
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...

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.