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

refering to a subform control

Main form-frmCheckRequest
Sub form-subfrmCheckRequestPayments

On my subform I have 2 fields FundCode and ClassNumber. Both are comboboxes.
I'm trying to filter ClassNumber based on FundCode.

When I create a separate query it returns the records I expect based on the
record I select in the subform. Here's the query code.

SELECT dbo_FundClasses.ClassNumber, dbo_FundClasses.FundCode
FROM dbo_FundClasses
WHERE
(((dbo_FundClasses.FundCode)=[Forms]![frmCheckRequest]![subfrmCheckRequestPa
yments].[Form]![FundCode]));

When I set the rowsource of ClassNumber to the same query I get the same
records no matter which subform record I select. The list presented is
always being filtered from the first subform record even if I select another
record with a different fundcode.

Any ideas?
Nov 13 '05 #1
4 1327
Terri wrote:
Main form-frmCheckRequest
Sub form-subfrmCheckRequestPayments

On my subform I have 2 fields FundCode and ClassNumber. Both are comboboxes.
I'm trying to filter ClassNumber based on FundCode.

When I create a separate query it returns the records I expect based on the
record I select in the subform. Here's the query code.

SELECT dbo_FundClasses.ClassNumber, dbo_FundClasses.FundCode
FROM dbo_FundClasses
WHERE
(((dbo_FundClasses.FundCode)=[Forms]![frmCheckRequest]![subfrmCheckRequestPa
yments].[Form]![FundCode]));

When I set the rowsource of ClassNumber to the same query I get the same
records no matter which subform record I select. The list presented is
always being filtered from the first subform record even if I select another
record with a different fundcode.
What I would do is copy the SQL code and paste it into a new query.
Query/new/design/close/viewsql and paste. Now open the form. now get
to the query and attempt to open/run. If it blows up, it will show you
where it does.

I'm not sure the .[Form] is necessary. I might do something like this

Dim strSQL As STring
strSQL = "SELECT ClassNumber, FundCode " & _
"FROM dbo_FundClasses " & _
"WHERE dbo_FundClasses.FundCode = " & _
[Forms]![frmCheckRequest]![subfrmCheckRequestPayments]![FundCode]

Me.ComboNameInYourForm.Rowsource = strSQL

I'll assume FundCode is a numeric value, otherwise you need quotes.
"WHERE dbo_FundClasses.FundCode = '" & _
[Forms]![frmCheckRequest]![subfrmCheckRequestPayments]![FundCode] & "'"

Any ideas?

Nov 13 '05 #2
What I would do is copy the SQL code and paste it into a new query.
Query/new/design/close/viewsql and paste. Now open the form. now get
to the query and attempt to open/run. If it blows up, it will show you
where it does.
When I copy into a new query I get my expected results. I switch between
subform records and the separate query works fine.

I'm not sure the .[Form] is necessary. I might do something like this


It doesn't seem to be necessary but removing this does not solve the
problem.

Thanks for your reply

Nov 13 '05 #3
If I put a refresh on the OnCurrent event of the subform it works. Is this
normal?

"Terri" <te***@cybernets.com> wrote in message
news:dd**********@reader2.nmix.net...
What I would do is copy the SQL code and paste it into a new query.
Query/new/design/close/viewsql and paste. Now open the form. now get
to the query and attempt to open/run. If it blows up, it will show you
where it does.


When I copy into a new query I get my expected results. I switch between
subform records and the separate query works fine.

I'm not sure the .[Form] is necessary. I might do something like this


It doesn't seem to be necessary but removing this does not solve the
problem.

Thanks for your reply

Nov 13 '05 #4
Terri wrote:
If I put a refresh on the OnCurrent event of the subform it works. Is this
normal?
I don't know. I usually requery. But if it works, that's what's important.

"Terri" <te***@cybernets.com> wrote in message
news:dd**********@reader2.nmix.net...
What I would do is copy the SQL code and paste it into a new query.
Query/new/design/close/viewsql and paste. Now open the form. now get
to the query and attempt to open/run. If it blows up, it will show you
where it does.


When I copy into a new query I get my expected results. I switch between
subform records and the separate query works fine.

I'm not sure the .[Form] is necessary. I might do something like this


It doesn't seem to be necessary but removing this does not solve the
problem.

Thanks for your reply


Nov 13 '05 #5

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

Similar topics

1
by: David B | last post by:
I have a sub form in datasheet view on a form. I want a query to find the recordid every time a different row on the datasheet has the focus. The query is grabbing data for a combo on a second sub...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
3
by: Kranman | last post by:
Hi All, Love this site, have gotten a lot from it. This is my first time posting though, so forgive me for any errors. I have an Access 2000 db where I have a main form of Contractors and on...
4
by: rhc | last post by:
access 2000 I have a tab control with 2 pages and one subform on each. On parent form P from the form_current() event of subform A I cant seem to refer to subform B. msgbox forms!.form.name...
6
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few...
7
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm...
5
by: CanOfWorms | last post by:
Access 2003 (previous 2000) Windows XP Pro I am fairly new at VBA within Access, learning as I go thorugh forums and discussion groups. I generally find my answers through previous posts, but I...
1
by: veteranwebdesign | last post by:
Hello, I have a main form. I want forms to open in a subform control box. What is the code for the option group to open the subforms in the control box. I didn't create subforms, I created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
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.