473,732 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!Payment Details.Records ource="PaymentD etails_qry"

but this is giving me an error.

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

Me.ctlNameOfSub formControl.For m.PropertyOrCon trol

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**@mindsprin g.com> wrote in message
news:cx******** *********@newsr ead3.news.atl.e arthlink.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!Payment Details.Records ource="PaymentD etails_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!PaymentDetai ls.Form.Records ource="PaymentD etails_qry"

Check that your subform control os named PaymentDetails.

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

"Bill Agee" <ws**@mindsprin g.com> wrote in message
news:cx******** *********@newsr ead3.news.atl.e arthlink.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!Payment Details.Records ource="PaymentD etails_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
10622
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 subform within that. What is the correct syntax? Thanks.
4
1659
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 subform wizard. Instead of a "RecordSource", it is "SourceObject"(query or table). I am creating a database for someone that does not have the access wizard installed (normally I don't use it much anyways) and when I create a subform and want to...
4
54890
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 routine. I had hoped I could do mytable.recordsource = myquery
1
5096
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 create an sql string that is to be used as the recordsource for the subform. The subform is requeried and all is apples. However I can't work out how to do this when the recordsource for the subform has to be a pass through query. I have a...
2
2393
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 unbound textboxes. When a user enters in a value into a field and hits the search button this opens up a results form called "people3" and sets a subform in this "people3" form - called "results" to show certain records matching the entered search...
9
24610
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 that data (checked by pasting the statement into a new Access Query in the database window). Me.FutureSubform.SourceObject = "FutureProjectionSubForm" Me.FutureSubform.Form.RecordSource = "SELECT * FROM " Me.FutureSubform.Form.Requery Is...
2
4786
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 delivery" instead "Item". To select the right subforms I make use of this sub: ***************************************************** Private Sub opzSelezione_AfterUpdate()
8
4369
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 no Master/Child relationship set to the main form. Specifically the problem seems to be that everytime the recordsource of the subform is changed, the subform object itself tries to set a default Master/Child value (both fields fill with the "ID"...
3
10687
by: Simon van Beek | last post by:
Dear reader, How to change the RecordSource for a subReport. For forms the syntaxes is:
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9234
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
9180
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...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
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
6030
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
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.