473,803 Members | 3,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 39629
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.Re query -- 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.goo gle.com...
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.Requer y as a macro. Oops. I have tried Me!ComboBoxA.Re query
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.go ogle.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 "AfterUpdat e" property of the first combo box to:

cmbSecondComboB ox.requery
or
docmd.requery "cmbSecondCombo Box"

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
2062
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, which says "complete" or "incomplete" depending on the status of an order. When I first open the form, the code/sql executes, and sets the correct
2
3673
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 controls on the form and uses them a the criteria for changing the query definition that the form is based on - so far so good.
1
1898
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 combobox, there is a VBA action: ME.REQUERY. That works very fine: the user sees always the result of his selection(s). There is also a textbox in the header that shows the number of records in the form (Therefore I use DCOUNT). Now I've got two...
2
3160
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 tab control "on change" event. This works for the 'first tab' but then does not work for any other tab.
0
1111
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 embedded in a web page with Internet explorer. The component has been installed in the GAC and assigned Full Trusted Permission,
2
1707
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 being empty, it has some content, and this gives a better idea of what the form will look like when run. During runtime it should be empty to start with, so I comment out the code in the constructor that fills it with dummy data. How can I code...
1
2247
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 so that the new data is instantly available. What do I need to put into the requery Control Name? The Sub Form is called 'History_Screen' The Table is called 'History'
0
1537
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 Update and On Got Focus) to display info on the list box of the form. The info is correct. The problem that I am having pertains to the screen continues to flash as the cursor moves over certain other items on the form (i.e. Command Buttons / Text...
4
4167
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 Form "A" and it contains a List Box and a Button. The record source for the list box is a simple select query from one table. In the List Box, I do not see the item I am looking for, so I want to add it. I click the Button and up pops Form "B". I...
10
7178
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 have a command button, called cmdDelete, that launches a dialog form, called frmDeleteCurrentRecord, where the user has to enter their name and a reason. I have managed, through a ton of trial and tribulation, found a way to delete the current...
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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
10548
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...
0
10316
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
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
9125
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
7604
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
5500
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.