473,503 Members | 12,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Requery of Subform with combo box

I have a subform that has a query on another table. One of the fields
is based on the contents of another table. When the user selects one
or other option in the main form I want the the records in the combo
box to show the new selection.

I have tried putting the requery action in many of the events on the
main form but cannot get it to refresh to show the new records. If I
close the form and reopen it or use Records - Refresh on the menu of
course it all updates correctly.

Hopefully this illustrates the problem.

frmMain form - sfrmSubform - qrytblTable - tblTable - RowSource
| ^
| |
Option Group tblRows
| ^
| |
Option buttons----->tblRecordType----------------------->|

Where and how do I place the requery, if that is the way to do it?

Nov 13 '05 #1
1 5323
In the AfterUpdate Event of each option put the following:

Dim Qry as string

Qry = "SELECT * FROM TblName WHERE Condition" (Whatever you want to
select)
ComboBox.Rowsource = Qry
DoCmd.Requery "ComboBox"

If you are using Option Buttons put an IF condition to check it the
Option Button's value = -1 otherwise it will check when you deselect
the option too which is not what you want.

Nov 13 '05 #2

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

Similar topics

1
1657
by: Jimmy | last post by:
Does anyone know if refreshing particular row data possible in subform? For example: Subform has two field: Vendor and product In first row, is it possible that when you select a vendor only...
0
429
by: Michelle | last post by:
Hi all I have a main form which has a combo box and a subform. The two forms are linked by ShiftPatternName which is basically the value in the combo. the combo has the following code ...
4
6968
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
0
1162
by: Robert | last post by:
Thanks and would like to use your suggested join approach however tblSub.FieldA is one field of a two field key (2nd key field say FieldB) for tblSub. So need to exclude tblX.fieldAs in the combo...
14
11441
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button....
2
1919
by: cmichaud | last post by:
Previously i had a combo box where i could select a name and then click a button and a subform on that form would requery and give me the information i wanted. However, i have now changed the...
1
3721
by: kimj.dk | last post by:
Hi, I have a form with a subform where the subform uses the value from a combo box on the main form as a query criteria. I don't want the subform to update or get data before the user has selected...
1
1430
by: kaleshire | last post by:
I have a form that has two combo boxes which are used to find a record for the subform. An AfterUpdate event on the second combo box runs ... Me.vtrack.Requery this part works perfectly, and when...
6
7978
by: MarkoBBC | last post by:
Hi everyone, First a brief description of my form: I have a subform within a main form. In my subform, I have a listbox displaying address information by firm name. A user first has to select a...
5
8096
by: ApexData | last post by:
I have a ComboBox, when dblClicked, displays the combobox's row content in a continuous subform. Changes can be made to this content in the subform and then closed. The ComboBox needs to be...
0
7098
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
7364
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
7017
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
7470
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
5604
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,...
1
5026
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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...

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.