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

Populating subform

hi ,

I created a database using Access 2000 with 2 tables and 2 forms. one is main form and the other subform with ID and Name as common fields. I have a command button in main form which is used to open the subform. Now my question is whenever I enter ID or Name in the main form and then click on the subform it should give me the whole record in the subform which is related to the ID or Name in the main form. I am able to open the form with the ID but each time if i enter a ID the subform opens with the ID but the details in the subform remain the same as of the previous record, it is not giving the current record for the ID entered. I am stuck at this point and unable to complete my project which is due for monday.If anyone can help me out this would be grateful.I am new to access eenvironment.
Nov 30 '06 #1
9 3645
MMcCarthy
14,534 Expert Mod 8TB
hi ,

I created a database using Access 2000 with 2 tables and 2 forms. one is main form and the other subform with ID and Name as common fields. I have a command button in main form which is used to open the subform. Now my question is whenever I enter ID or Name in the main form and then click on the subform it should give me the whole record in the subform which is related to the ID or Name in the main form. I am able to open the form with the ID but each time if i enter a ID the subform opens with the ID but the details in the subform remain the same as of the previous record, it is not giving the current record for the ID entered. I am stuck at this point and unable to complete my project which is due for monday.If anyone can help me out this would be grateful.I am new to access eenvironment.
Subforms are generally only bound to the main form with one field e.g. ID. If you want to use both fields then you can only set it where both fields are matched unless you use filters which is complicated.

If you want to set it for both fields then you need to check the properties of the subform object (the frame). Under the data tab there are two properties called 'Link Child Fields' and 'Link Master Fields'. Both fields should be represented as follows:

[ID];[Name]
Dec 1 '06 #2
thank you for the reply. as you said i will just go with one field so that it can populate the related fields in subform.

And also i don't find any linkchildfield and linkparentfield in my subform as i hv created the form through wizard and attached it to the command button onclick() event. i just wanted to know how we write the code in order to call the details for subform with the main form ID field.
Dec 2 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
thank you for the reply. as you said i will just go with one field so that it can populate the related fields in subform.

And also i don't find any linkchildfield and linkparentfield in my subform as i hv created the form through wizard and attached it to the command button onclick() event. i just wanted to know how we write the code in order to call the details for subform with the main form ID field.
The properties aren't on the subform they're on the subfom object. In main form design view click on the frame around the subform and open properties. You'll find them under the data tab.

Mary
Dec 2 '06 #4
I understand what you are saying but as I said I have created the subform using the icon "create a form through wizard". I haven't created using the subform wizard. So, now what do you suggest me for this?
Dec 2 '06 #5
Hey I am sorry I was bit confused between the forms. As I mentioned it is a main form and subform I was wrong in that. Actually my database contains a form in which I have command button by clicking on it a pop up form opens up..so, i wanted the details to be populated in the pop up form with the field ID on the main form.
Dec 2 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
Hey I am sorry I was bit confused between the forms. As I mentioned it is a main form and subform I was wrong in that. Actually my database contains a form in which I have command button by clicking on it a pop up form opens up..so, i wanted the details to be populated in the pop up form with the field ID on the main form.
You need to set criteria on the open form command.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub ButtonName_Click()
  3. Dim stDocName As String
  4. Dim stLinkCriteria As String
  5.  
  6.    stDocName = "PopupFormName"
  7.    stLinkCriteria = "[ID]=" & Me.ID
  8.  
  9.    DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. End Sub
  12.  
Dec 2 '06 #7
I have tried as you said but when the pop up form opens it just opens with the Id ,it does not give the details on the pop up form related to that Id. Wht I should do for this?
Dec 4 '06 #8
MMcCarthy
14,534 Expert Mod 8TB
I have tried as you said but when the pop up form opens it just opens with the Id ,it does not give the details on the pop up form related to that Id. Wht I should do for this?
Your popup form must be bound to the table or query to populate the data. All the criteria does is tell it which record to open.
Dec 4 '06 #9
Thank you so much for helping me out. I never thought that this will be very simple.

Once again thank you so much...........
Dec 4 '06 #10

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

Similar topics

1
by: John Hargrove | last post by:
I am building a database to manage test samples in an environmental laboratory. I am learning Access as I go and don't know much about the programming aspects. I hope to make the application...
0
by: Lauren Quantrell | last post by:
I'm using SQL Server backend on an Access 2K front end. I populate a subform: Forms!myForm.myChild.Form.RecordSource = "myStoredProcedureName" On that form is a control where the controlsource is...
1
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates...
4
by: Don Do | last post by:
Help I built a form/subform/subsubform setup using the access forms wizard. I have a table1 = parent, table2 = child, table3 = (grandchild?). There will be multiple records in table2 that tie...
19
by: hexagram | last post by:
Hi guys good day, can anybody help for my problem The Scenario is A Listbox (ID) - Multiple Select - everytime i choose in the list box the following outbound textbutton and subform will...
13
by: Mary | last post by:
I'll pulling my hair out on this one and would be so appreciative of any help. I am creating a data entry form to enter results of a student survey. There are 40 questions on the survey. The...
1
by: canam | last post by:
I hope someone can help me with this. I have an input form with a subform that opens up in data sheet view. The subform is called based on 2 fields - BusinessName & Commodity - in other words...
3
by: GODSPEEDELECTRONICS | last post by:
My database is simple. It has a table that tracks customers, with they're name, address, etc. I have a price list table that contains "iteminstall" , "price", and "qty" and I have a payment...
24
by: bkberg05 | last post by:
Hi - I have a form called mainForm that has a subform called subForm. The subform has a numeric field called subCost. There are many subForm records for every mainForm record. On the main form,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.