473,802 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Matching a value from one form to another

Hello all,
Here is what i am trying to do doing:
Form A & Form B
Form A:
compressor_id = 23
Description: test

Form B:
stage_id = 12
compressor_fk = compressor_id
Description: test2

I create a button in Form A so when I click it it will take me to Form
B. I have the relationship b/w my tables, where COMPRESSOR (name of
table) compressor_id = compressor_fk in the STAGES table. That is
working fine. Now what I want is: when I click on the button that takes
me to Form B, it will automatically display my compressor_id into the
compressor_fk. Right now, I can type the compressor_id into my Form B
and it will recognize it w/o any problem. I tested by going to the
tables and I can see the values are matching (compressor_id and
compressor_fk).
Summary: I want it to automatically display the compressor_id in my
Form B, I do not want to type it.

Please help, thank you

Jul 18 '06 #1
12 2823
"erick-flores" <ch**********@h otmail.comwrote in
news:11******** **************@ h48g2000cwc.goo glegroups.com:
Hello all,
Here is what i am trying to do doing:
Form A & Form B
Form A:
compressor_id = 23
Description: test

Form B:
stage_id = 12
compressor_fk = compressor_id
Description: test2

I create a button in Form A so when I click it it will take me
to Form B. I have the relationship b/w my tables, where
COMPRESSOR (name of table) compressor_id = compressor_fk in
the STAGES table. That is working fine. Now what I want is:
when I click on the button that takes me to Form B, it will
automatically display my compressor_id into the compressor_fk.
Right now, I can type the compressor_id into my Form B and it
will recognize it w/o any problem. I tested by going to the
tables and I can see the values are matching (compressor_id
and compressor_fk).
Summary: I want it to automatically display the compressor_id
in my Form B, I do not want to type it.

Please help, thank you
In the OnClick Event on form A you need to add a command which
copies the value of the control on form A to the equivalent
Control on form B, after the command that opens form B.

Forms!form_B!co mpressor_fk = me.compressor_i d
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 18 '06 #2
Thank for your answer

I did what you told me but I am getting an error message:

Private Sub Command22_Click ()
On Error GoTo Err_Command22_C lick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "STAGES"
DoCmd.OpenForm stDocName ', , , stLinkCriteria
forms!Stages!co mp_fk = Me.comp_pk

Exit_Command22_ Click:
Exit Sub

Err_Command22_C lick:
MsgBox Err.Description
Resume Exit_Command22_ Click

End Sub

The line "forms!Stages!c omp_fk = Me.comp_pk"
----!Stages <---- it higlight this, and says:
Compile error:
Qualifier must be collection

Stages is the name of my Form B

Any suggestions? I am going crazy with this if you can help I will
really aprecciate

Thanks

Jul 18 '06 #3
I am also trying:

Private Sub Command22_Click ()
On Error GoTo Err_Command22_C lick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "STAGES"

stLinkCriteria = "[comp_fk]=" & Me![comp_pk]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command22_ Click:
Exit Sub

Err_Command22_C lick:
MsgBox Err.Description
Resume Exit_Command22_ Click

End Sub

This is working fine, it just wont display the value from the Form A to
the Form B. Is there an option to display the value from the Form A to
Form B? because the "[comp_fk]=" & Me![comp_pk] its working but its not
displaying the value. I wanna see my value displayed from form A to
form B.

Please helppp :'(

Jul 18 '06 #4
This is working fine, it just wont display the value from the Form A to
the Form B. Is there an option to display the value from the Form A to
Form B? because the "[comp_fk]=" & Me![comp_pk] its working but its not
displaying the value. I wanna see my value displayed from form A to
form B.

Please helppp :'(
If you're trying to _copy_ the value, then you have to set it

Forms![MyFormB]![ControlName]=Forms![MyOpenFormA]![ControlName]

Jul 19 '06 #5
"erick-flores" <ch**********@h otmail.comwrote in
news:11******** **************@ 35g2000cwc.goog legroups.com:
Thank for your answer

I did what you told me but I am getting an error message:

stDocName = "STAGES"
DoCmd.OpenForm stDocName ', , , stLinkCriteria
forms!Stages!co mp_fk = Me.comp_pk
The line "forms!Stages!c omp_fk = Me.comp_pk"
----!Stages <---- it higlight this, and says:
Compile error:
Qualifier must be collection

Stages is the name of my Form B
comp_fk is the name of the control on that form, which may be
different from the field name in the table?
same question about comp_pk.

It may also be a timing issue, the form may not open quickly
enough. Try a doevents statement between the Docmd.Openform line
and the one which sets the variable.

See also mr Linden's notes about [] around the elements in the
expression. They are necessary only with spaces and punctuation
in element names, but it doesn't hurt to include them.

since the code is in form A, me. should work, as a reference to
the form, but you can go with the long notation too..
>
Any suggestions? I am going crazy with this if you can help I
will really aprecciate

Thanks


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 19 '06 #6

Hello

Thank you guys for helping me. I finally figured out.

Jul 19 '06 #7
OK, So I am getting another problem. I dont know whats happend with
this, but sometimes it works sometimes it doesnt. Its driving me crazy,
but anyways. When I click the button to open Form B it is showing the
foreign key from my Form A BUT it its also automatically displaying the
primary ID of Form B. This primary key i set it up =Autonumber. This
was not happening before. Any suggestions'???

Jul 19 '06 #8
"erick-flores" <ch**********@h otmail.comwrote in
news:11******** **************@ 75g2000cwc.goog legroups.com:
OK, So I am getting another problem. I dont know whats happend
with this, but sometimes it works sometimes it doesnt. Its
driving me crazy, but anyways. When I click the button to open
Form B it is showing the foreign key from my Form A BUT it its
also automatically displaying the primary ID of Form B. This
primary key i set it up =Autonumber. This was not happening
before. Any suggestions'???
I can tell you why it is happening now and wasn't happening
before, and you can decide whether to handle it.

Before, when you opened form B, the autonumber did not appear
UNTIL you typed something in any textbox on the form.

Because you have some code that types something into one of the
textboxes, it makes the autonumber appear as soon as you open
the form.

why are you displaying the ID on the form anyways? It is not
reccommended.
Jul 19 '06 #9
Hello Bob

That was not the real problem, I didnt explain very well in the last
reply. The problem is: It will display the SAME primary key in Form B
everytime I click on the button to go from Form A to Form B. So
obviusly it is changing the same record all the time I switch to Form
B. i do not knwo why this is happend, because the option to that
primary key is Autonumber, so it supposed to display a different number
everytime the form opens, or not? maybe I am doing something wrong. I
tried both Autonumber (increment, random) and I got the same
environment.

why are you displaying the ID on the form anyways? It is not
reccommended.
I am only displaying the ID to see if its working, just for
functionality issues. But I will remove the ID from the forms once I
know its working well, once all my forms are related through the pk and
fk. I guess I will just select the "hide = yes" option for that field.

Thanks

Jul 20 '06 #10

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

Similar topics

2
3731
by: Hennie | last post by:
I apologise if this is a stupid question, but I would appreciated any help on this subject. I want to create a view (VIEW_1 in example below) where I take numeric values from a field in one table (DEPTH_FROM in TABLE_1) and find the closest matching values from another field in another table (DEPTH_AT in TABLE_2) - the higher matching value and the lower matching value. TABLE_1
16
11288
by: Martin Jørgensen | last post by:
Hi, Short question: Any particular reason for why I'm getting a warning here: (cast from function call of type int to non-matching type double) xdouble = (double)rand()/(double)RAND_MAX;
6
1839
mmarif4u
by: mmarif4u | last post by:
Hi everyone. i make a page that a user input thier icnumber with confirm ic number, it saves the data to mysql db with current date and a random access code generated automatically, NOW i have some problems facing.. 1: How to match both txt box vlaues that r same or not.Is there php code for it. 2: I want to put a print button in the code where the code display the page after entring the icnumber and after submit. 3: How to show the...
18
2662
by: Drayno241 | last post by:
I'm working in access 2002. I have three tables : 1- District Data (Student ID, name, grade, etc) 2- Rosters (RRec ID,Campus, Teacher ID) 3- Students on Roster(SRec ID, RRec ID, Student ID) There's a 1 to many relationship between Rosters and Students on Roster. I created a form and subform to populate the Rosters and Students on Roster. The Students on Roster subform simply accepts the Student ID's (datasheet format) and if the...
1
1818
by: .nLL | last post by:
Hi, i ma trying to change a dropdown box index to mathing value of on another dropdown box in same form. here is the form -------------------------------------------------------------------------------------------------------------------------- <form method="post" name="myform" action="default.asp"> <p> Select Month: <select name="mymonth" onChange="document.getElementById('myday').selectedIndex=0"> <option value="20080401"...
2
1535
by: .nLL | last post by:
got below script, works fine with IE but fails on opera. my js knowledge is very limited and can't find whats wrong with it. ---------------------------------------------- function selectMatching(x) { var S = document.getElementById("mymonth"); var L = S.options.length; for (var i=0; i <= L-1; i++) {
5
2147
by: gentsquash | last post by:
In a setting where I can specify only a JS regular expression, but not the JS code that will use it, I seek a regexp component that matches a string of letters, ignoring case. E.g, for "cat" I'd like the effect of () but without having to have many occurrences of .
2
2042
by: Zetten | last post by:
I've got a script which basically goes line by line through an external file, and hands it to the screen in a slightly parsed form. I'd like to apply another bit of parsing to what's coming in though, and specifically look for a pattern matching "]" where x can be any number. If that string is found, I'd like to grab the "x" part, pass it through a subroutine, and then replace the "]" and everything in between with a variable. I think I...
0
1757
by: grego9 | last post by:
I have a bit of visual basic code in an excel spreadsheet that I need some help with. I am attempting to search a file called TO Cancellations2.xls for counterparty names and for each counterparty name that it finds that matches the list of counterparties on the "counterparties" sheet of a file called Time Option Template WIP.xls I want the whole line copied and pasted into a new excel worksheet that should have the counterparty name and then...
0
9699
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
10305
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...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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...
1
7598
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
6838
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
5494
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
4270
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
2
3792
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.