473,326 Members | 2,048 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,326 software developers and data experts.

Dynamically assign Recordsource to subform

I have a subform called PaymentDetails and would like to dynamically assign
the recordsource after the form/subform is opened.

The recordsource for Payment Details is "PaymentDetails_qry" which uses
a function to filter the Invoice #. The invoiceID is not known until after
the
form is opened. After the InvoiceID is selected from a dropdown I then
want to assign the recordsource

Me!Form!PaymentDetails.Recordsource="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?
Nov 13 '05 #1
2 3619
The path to the subform is

Me.ctlNameOfSubformControl.Form.PropertyOrControl

The Subform Control is a control on the main form that holds the subform. To
get the name of this control (it may or may not be the same as the subform,
depending on how you added the subform to the main form), open the main form
in design mode, open the Properties sheet, and click on the subform ONE
time. The Properties sheet should show the name of the subform control. If
you click more than once, you'll be in the subform and the Properties sheet
will show the name of the subform or its components, not the name of the
control holding the subform.

--
Wayne Morgan
MS Access MVP
"Bill Agee" <ws**@mindspring.com> wrote in message
news:cx*****************@newsread3.news.atl.earthl ink.net...
I have a subform called PaymentDetails and would like to dynamically assign
the recordsource after the form/subform is opened.

The recordsource for Payment Details is "PaymentDetails_qry" which uses
a function to filter the Invoice #. The invoiceID is not known until
after
the
form is opened. After the InvoiceID is selected from a dropdown I then
want to assign the recordsource

Me!Form!PaymentDetails.Recordsource="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?

Nov 13 '05 #2
Bill,

"Form" is in the wrong place. Use the Form property to identify that you are
making reference to the form the subform control contains----
Me!PaymentDetails.Form.Recordsource="PaymentDetail s_qry"

Check that your subform control os named PaymentDetails.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Bill Agee" <ws**@mindspring.com> wrote in message
news:cx*****************@newsread3.news.atl.earthl ink.net...
I have a subform called PaymentDetails and would like to dynamically assign the recordsource after the form/subform is opened.

The recordsource for Payment Details is "PaymentDetails_qry" which uses
a function to filter the Invoice #. The invoiceID is not known until after the
form is opened. After the InvoiceID is selected from a dropdown I then
want to assign the recordsource

Me!Form!PaymentDetails.Recordsource="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?

Nov 13 '05 #3

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

Similar topics

5
by: Ellen Manning | last post by:
Using A2K. I need the syntax to set the recordsource for a subform within a subform. The "main" subform's recordsource changes based on user input. I need to change the recordsource on the...
4
by: Mr. Bungle | last post by:
Just when I thought I knew everything... Does anyone know why sometimes when creating a subform, the RecodSource property is totally unavailable, this appears to happen when you don't use the...
4
by: Peter Bailey | last post by:
I have a subform that I dont want to have a recordsource initially as it is locking the table that is created dynamically. I want to connect to the table after the data has been written by another...
1
by: bentond | last post by:
I am trying to write a simple form that allows a user to search through an address table. The main form has the text boxes (to be used as where parameters) and when clicking the search button will...
2
by: Bex | last post by:
Hi All. I'm attempting at the moment to set the recordsource of an unbound subform when i open up it's main form. My view is to have one intial form - called "Search" which has a number of...
9
by: robert d via AccessMonster.com | last post by:
I'm not sure why the following isn't working. The subform loads correctly, but no data is displayed. I'm certain that there is data and I have checked that the SQL statement does in fact return...
2
by: Eugenio | last post by:
Sorry in advance for my english. :-) I have a form MS Access97 with two subforms. These subforms have different data and dimensions, if into the main form I've selected with checkbox "Date of...
8
Megalog
by: Megalog | last post by:
Hey guys.. my turn to ask a question: I'm having a weird issue with a form I've reworked. This form has a combo box, which when used is changing the recordsource of a subform. This subform has...
3
by: Simon van Beek | last post by:
Dear reader, How to change the RecordSource for a subReport. For forms the syntaxes is:
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.