473,399 Members | 4,192 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,399 software developers and data experts.

Using subform to provide select critera for a further subform

56
I have a form which I have set up which uses a combo box to provide supplier names. When you select a supplier name, it runs a small piece of VBA SQL which populates a subform with Product Codes and descriptions.

What I am hoping to do is this, I would like the user to be able to select a record within this subform and a 2nd subform populates with a date and prices for that particular product.

The data is coming from 3 tables:

Supplier Details
Product Details
Product Prices (over time)

The first part of my attempt is fine, I can get the 1st subform to narrow down by supplier name ok. Yet I can't figure out for the life of me how I can get from clicking between records in the subform to populating the 2nd subform on the sheet. Things like AfterUpdate, SelectionChange etc don't appear to be doing anything.

In case it helps, here is the code that is populating the first subform:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Option Compare Database
  3. Private Sub Form_Open(Cancel As Integer)
  4.  
  5. '    Call subroutine to set filter based on selected Supplier Name
  6.     SetFilter
  7.  
  8. End Sub
  9.  
  10. Sub SetFilter()
  11.  
  12.     Dim LSQL  As String
  13.  
  14.     Me.Refresh
  15.  
  16.     LSQL = "SELECT * FROM SupplierDetails"
  17.     LSQL = LSQL & " WHERE SupplierDetails.SupplierName = '" & Combo87 & "'"
  18.  
  19. '    Debug.Print LSQL
  20.     Form_Maintain_SuppDet.RecordSource = LSQL
  21.  
  22. End Sub
  23.  
  24. Private Sub Combo87_AfterUpdate()
  25.  
  26.    ' Call subroutine to set filter based on selected Supplier
  27.     SetFilter
  28.  
  29.  
  30. End Sub
  31.  
  32.  
Apr 18 '07 #1
3 1410
Rabbit
12,516 Expert Mod 8TB
If you are on the main form, the syntax is:
Expand|Select|Wrap|Line Numbers
  1. Me.Subform_Name.Form.RecordSource
If you are on the subform, the syntax is:
Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource
If you are on a different subform, the syntax is:
Expand|Select|Wrap|Line Numbers
  1. Me.Parent.Subform_Name.Form.RecordSource
The absolute path is:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![Main Form]![Sub Form Object].Form.RecordSource
Apr 18 '07 #2
Widge
56
Precise and to the point! Thank you very much, I shall try that today. Much appreciated.

Making this thing is a new learning experience each day!
Apr 19 '07 #3
Rabbit
12,516 Expert Mod 8TB
Precise and to the point! Thank you very much, I shall try that today. Much appreciated.

Making this thing is a new learning experience each day!
Not a problem, good luck.
Apr 19 '07 #4

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

Similar topics

12
by: turtle | last post by:
I am creating a database that tracks the Techinical Skills of our engineers. There are about about 200 techinical skills that they will need to fill out by giving themselves a ranking. Some...
3
by: I_was_here | last post by:
Hey if anyone is a query pro please showoff some knowledge thx. Ie: I have a table with : part price location qty 1 part repeats throughout the table and its price remains the same but it...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
0
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary...
3
by: stuart.medlin | last post by:
I have an Access 97 application that has a basic form (Transcript) and subform. The subform has a query as a recordsource that returns records from a table: SELECT DISTINCTROW Transcript.NCID,...
1
by: keri | last post by:
Hi and apologies for duplicates. I am having some posting issues so thought i'd start afresh. Please treat me as a beginner so I get very simple explanations! The below is driving me crazy; ...
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
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: 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
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...
0
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...
0
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...
0
agi2029
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,...

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.