473,471 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't update RecordSource of subform

6 New Member
I have a combo box that I am using to select a CustomerID from a table called Customers. Once a value has been selected I would like to update the RecordSource property of a sub form called order_entry_frm so that it will filter Order records for that customer. I tried the following...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboCustomer_Change()
  2.   strSQL = "SELECT OrderID, OrderDate, RequiredByDate, DatePaid " & _
  3.   " FROM Orders_tbl " & _
  4.   " WHERE CustomerID=" & Me!cboCustomer.Value & ";"
  5.   Me!order_entry_frm.RecordSource = strSQL
  6.   Me!order_entry_frm.Requery
  7. End Sub
  8.  
...but got a compiler debug message pointing at line " Me!order_entry_frm.RecordSource = strSQL" which said "Run-time error 438. Object does not support this property or method".

Is there another/better way of doing what I want?

TIA,
Nick.
Feb 28 '07 #1
6 3780
Rabbit
12,516 Recognized Expert Moderator MVP
I believe the correct syntax is Me.order_entry_frm.Form.RecordSource
Feb 28 '07 #2
nickweavers
6 New Member
Great, that fixed it.

Many thanks Rabbit.
Feb 28 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Not a problem.
Feb 28 '07 #4
NeoPa
32,556 Recognized Expert Moderator MVP
A better way to get the results you want would be to use the .Filter property instead, followed by a .requery.
Mar 2 '07 #5
nickweavers
6 New Member
Hi Neopa,

How does the Filter proprty work? Is it a way of just appending "criteria" to an existing query?
Mar 11 '07 #6
NeoPa
32,556 Recognized Expert Moderator MVP
Absolutely.
A report or form object can be called from VBA code, and the fourth parameter of each is called 'WhereCondition'.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
  2. DoCmd.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
Whatever the RecordSource is for the object, it will be further filtered by the 'WhereCondition' parameter.
Mar 12 '07 #7

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

Similar topics

0
by: JJMM | last post by:
Hi, I have a form with a large number of subforms inside it (around 20 subforms), There is the possibility of filtering the data using a pop-up form that create/change a query (all the subforms...
1
by: JJMM | last post by:
Hi, I have a form (form1) with a large number of subforms inside it (around 20 subforms), There is the possibility of filtering the data using a pop-up form that create/change a query (all the...
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...
3
by: dixie | last post by:
I have a form full of subforms which bring summary information onto the form from about 12 different tables. I am trying to get all of that summary information (mainly numbers) into 1 large table...
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...
2
by: Bill Agee | last post by:
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...
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...
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,...
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...
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...
1
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.