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

How to Requery a control in a form

I have created a form that has a few combo boxes on it. On the form I
have ComboBoxA which selects data from a region, and ComboBoxB that
selects individual locations within a selected region. I need to
figure out the correct way to Requery ComboBoxA after I have updated
it. I searched the archive for this list and found a simple solution:
put Me.Requery in the AfterUpdate event of ComboBoxA. However, when
I try this I get an error message "... can't find the macro 'Me'.."
What am I doing wrong ?

Thanks for any help on this, Scott
Nov 12 '05 #1
5 39567
Do you mean you actually put "Me.Requery" in the Property Sheet for the
AfterUpdate Event of the Combo Box? That's the only thing I can think of
that would likely give you that particular message.

Two problems: the shortcut "Me" which refers to the active Form, not to a
particular control, can only be used in VBA code, and what you put in the
event property is not VBA code. Thus Access sees it doesn't read "Event
Property", and tries to interpret it as a macro, which it does not find.

To requery ComboBoxA, create an event procedure, and in the code put
Me!ComboBoxA.Requery -- but, be aware that requerying a combo box only makes
certain that its Row Source (the information in the dropdown list) is
up-to-date. I can't imagine why that would be necessary in the Combo's own
AfterUpdate event.

I can't quite determine from your statement of the problem if Combo Boxes A
and B are related to each other, or just to the Information on the Form.
Also "requrey ComboBoxA after I have updated it" -- to what does "it" refer
here, and what do you mean by "updated it"?

Please clarify and perhaps someone will be able to offer suggestions.

Larry Linson
Microsoft Access MVP

"Scott" <ko******@yahoo.com> wrote in message
news:12**************************@posting.google.c om...
I have created a form that has a few combo boxes on it. On the form I
have ComboBoxA which selects data from a region, and ComboBoxB that
selects individual locations within a selected region. I need to
figure out the correct way to Requery ComboBoxA after I have updated
it. I searched the archive for this list and found a simple solution:
put Me.Requery in the AfterUpdate event of ComboBoxA. However, when
I try this I get an error message "... can't find the macro 'Me'.."
What am I doing wrong ?

Thanks for any help on this, Scott

Nov 12 '05 #2
Larry,

Thanks for your reply. Well, in the time it took for this question to
get posted, I did figure out that I was assuming I could use
ME!Combo.Requery as a macro. Oops. I have tried Me!ComboBoxA.Requery
for several event procedures related to ComboBoxA and ComboBoxB, yet I
still haven't quite figured out how to make my form work. Perhaps,
Requery isn't what is needed.

Here's what I want to do: I have a Table with numerous fields
describing where field samples were taken. Two fields in the Table are
REGION and LOCATION. There are several region values in the Table and
numerous location values within each region. I would like to Create a
Form which allows the user to Select the region of interest, then
select a location within that region, then click a button and display
a query of the table based on values passed from the Form.

Here's the problem: On the first pass through MyForm, a user Selects a
region from numberous values in ComboBoxA, then in ComboBoxB, the
RowSource has criteria that only displays a subset of the total
locations based on the value for region that was set in ComboBoxA. The
user selects a location, then click's the button and up pops the
query, just fine. Then I close the query and make a second pass
through MyForm, changing the value of ComboBoxA, and then click in
ComboBoxB. But ComboBoxB still has values corresponding to the values
in ComboBoxA that were set in the first pass through MyForm. How do I
get ComboBoxB to update the RowSource based on the updated value of
ComboBoxA after I have changed ComboBoxA once or more ?
TIA, Scott
Nov 12 '05 #3
Still stummped on this one.... any suggestions will be greatly
appreciated.

Here's what I want to do: I have a Table with numerous fields
describing where field samples were taken. Two fields in the Table are
REGION and LOCATION. There are several region values in the Table and
numerous location values within each region. I would like to Create a
Form which allows the user to Select the region of interest, then
select a location within that region, then click a button and display
a query of the table based on values passed from the Form.

Here's the problem: On the first pass through MyForm, a user Selects a
region from numberous values in ComboBoxA, then in ComboBoxB, the
RowSource has criteria that only displays a subset of the total
locations based on the value for region that was set in ComboBoxA. The
user selects a location, then click's the button and up pops the
query, just fine. Then I close the query and make a second pass
through MyForm, changing the value of ComboBoxA, and then click in
ComboBoxB. But ComboBoxB still has values corresponding to the values
in ComboBoxA that were set in the first pass through MyForm. How do I
get ComboBoxB to update the RowSource based on the updated value of
ComboBoxA after I have changed ComboBoxA once or more ?
TIA, Scott
Nov 12 '05 #4
Ray
ko******@yahoo.com (Scott) wrote in message news:<12**************************@posting.google. com>...
Still stummped on this one.... any suggestions will be greatly
appreciated.

Here's what I want to do: I have a Table with numerous fields
describing where field samples were taken. Two fields in the Table are
REGION and LOCATION. There are several region values in the Table and
numerous location values within each region. I would like to Create a
Form which allows the user to Select the region of interest, then
select a location within that region, then click a button and display
a query of the table based on values passed from the Form.

Here's the problem: On the first pass through MyForm, a user Selects a
region from numberous values in ComboBoxA, then in ComboBoxB, the
RowSource has criteria that only displays a subset of the total
locations based on the value for region that was set in ComboBoxA. The
user selects a location, then click's the button and up pops the
query, just fine. Then I close the query and make a second pass
through MyForm, changing the value of ComboBoxA, and then click in
ComboBoxB. But ComboBoxB still has values corresponding to the values
in ComboBoxA that were set in the first pass through MyForm. How do I
get ComboBoxB to update the RowSource based on the updated value of
ComboBoxA after I have changed ComboBoxA once or more ?
TIA, Scott

Hello Scott,

Just set the "AfterUpdate" property of the first combo box to:

cmbSecondComboBox.requery
or
docmd.requery "cmbSecondComboBox"

Either of these should work.

Regards,

Ray
Nov 12 '05 #6

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

Similar topics

2
by: Craig M | last post by:
Hi, I currently have a form, tblRetailOrders, with subform, tblRetailOrderLine. In tblRetailOrders, I have a Yes/No for attrib "Complete". On the tblRetailOrders form, I had a text label,...
2
by: dkintheuk | last post by:
Hi all, Using Access 2000 on XP Pro PC. I have a form that is based on a presaved query - all fine with this. I also have a refresh button that takes the values from various unbound...
1
by: piet | last post by:
I have created a continues form, based on a query. In the header, there are some comboboxes that gives the user the possibility to make certain selections. Everytime a selection is made on a...
2
by: david.boone | last post by:
Hello, I am trying to enable controls based on the value of a checkbox, i.e. if value = true then enable. I have a tab control form with controls on 4 tabs. I have some code (below) on the...
0
by: Filippo Bettinaglio | last post by:
hi, I have developed a window control form in C sharp 2005, I can use the component in other .exe applications (just keeping the two project in the same solution group file) but I cannot use it...
2
by: TerryStone | last post by:
I have created a control that displays a list of items. During design mode I fill it with junk data using calls from the constructor. So when I look at a form with the control on, instead of...
1
by: Simon Argent | last post by:
I currently have a form which contains a macro. When a button is pressed, the macro opens up another form to allow a user to add data. When the form is closed, I want the macro do do a Requery...
0
by: GeoffT | last post by:
I have encountered a problem with the data that is displayed in the list boxes that are located on a tab control access form (2003 version). This form uses several combo boxes as filters (After...
4
by: AdamOnAccess | last post by:
I find that I always need to incorporate something like this into my forms, but I've never been happy on how I do it. Can someone advice me on the proper way to do this in Access. Let's say I have...
10
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.