Sending Data between Forms

Odessit80

Registered User.
Local time
Today, 11:47
Joined
Sep 10, 2004
Messages
18
I have a CUSTOMER form with a CUSTOMER_ORDER subform, which basically shows all the orders by each customer. However, when I select one of the records in the CUSTOMER_ORDER subform and click on the order button to take me to the ORDER form, it always shows the very first record of the subform in the ORDER form. In other words, it recognizes CustomerID, but it does not show the selected record in the subform in the ORDER form. It always shows the same very first record. What am I doing wrong?

Thank you very much for your help.

EDITED
 
Last edited:
You were a little unclear in your description (you mention using tables, and then your description of which form is the parent form and which is the subform is confusing), but as a general idea, I'd suggest: 1. checking the Master-Child link of the subform (in the properties of the subform, NOT the Form Properties of the subform), or 2. checking the "StLinkCriteria" attribute of the command button in the Visual Basic editor.
 
monkeytunes said:
You were a little unclear in your description (you mention using tables, and then your description of which form is the parent form and which is the subform is confusing), but as a general idea, I'd suggest: 1. checking the Master-Child link of the subform (in the properties of the subform, NOT the Form Properties of the subform), or 2. checking the "StLinkCriteria" attribute of the command button in the Visual Basic editor.


I am sorry, I am really new to this, I just started working with Access and I don't have a VB editor or know how to use it. Customer form is a parent CustomerOrder is a subform. At the bottom of the Customer Form I have a button that takes me the Order form. That form shows the correct CustID from Customer Form, but does display the correct order chosen in the CustomerOrder subform. It always shows the very first order. How do I get the properties of a subform?
Thank you very much, MT.
 
Last edited:
Hey O, sorry it took me a while to respond,

You don't need a VB editor - Access has one! While Visual Basic for Access is a bit different than normal ol' Visual Basic, it's similar enough to futz around with. You can either create new modules which you can call from different events, or you can code directly into events. So, for instance, you could muck around with the "On Click" event of any of your controls, or have some code run when a report or form opens, and so on. But it actually doesn't sound like your problem has to do with VB too much.

It sounds like your problem is with a popup form, not the subform to the main form, am I right?

(Just in case your problem IS with the subform, here's some help: To find the master-child link, select the properties of the subform (NOT the Form Properties of the subform). It can be difficult to get your mouse to focus on the subform, without focusing in the subform - try using the dropdown list on the upper left to choose your subform. Then go to properties, and check the Master-Child links!)

If the popup form is going to remain open on top of the forms you already have open, then it is relatively easy to have it jump to the record you want. You can create a command button using a wizard that will open the record you want for you.

If you're looking to make the popup form ready for new orders, then you can change the form property "Data Entry" to yes, and then in the Default Value property of your linked field/Foreign Key you could reference the linked field/Primary Key of the form that is open underneath: =[Forms]![YourMainForm]![LinkedField/PrimaryKey]

Hope that helps! (Sorry again for the delay!) :o If it doesn't help, Compact & Repair your DB, put it in a zip file and post it here and we'll see what we can do.
 
MT,

Thank you very much for your time and your effort to help me. I am sorry, I have been very busy and was unable to respond. I actually figured out the properties thing and all my child-master links seems to work fine. I am attaching my zipped database to explain what is not working. It must be something simple, but I still can't figure it out.

It sounds silly, I can't post my db since my .zip file ends up being 214KB after C & R and this site allows only 100. Is there any way to get around it?

In any case, let me try to explain what the problem is again. I have a customer form with the estimate subform. So when you open a customer form, there are a bunch of estimates for each customer in the estimate subform. Everything shows up fine, but the problem is that when I use a selector to choose one of the records of the subform and then click on the Estimate button(which takes me to the Estimate form), Estimate form shows the first record of the subform, regardless which record I chose in the subform.

Again, thank you very much for taking your time and being patient with a newbie like me :).
 
You need to use compound criteria in the OpenForm's where argument when you open the popup form:
"fld1 = " & Forms!MainForm!fld1 & " And fld2 = " & Forms!MainForm!Subform.Form!fld2

Don't forget the quotes if fld1 or fld2 is text.
 
Thanks, Pat.

Do I find the compound criteria in OpenForm's where argument under the Event tab in the form's properties?
 
I can tell by the question that you are confused but I can't identify the confusion. Post the code that open's the the form incorrectly and we'll show you how to change the where argument.
 
Pat,

Thank you for trying to help me. After I got your reply, I realized that I was so far off that I needed to figure out myself what to ask you. I found a place that was explaining VB for Access and your reply made sense and now I fixed the problem. Thank you for your help.
 

Users who are viewing this thread

Back
Top Bottom