I can't seem to get this figured out. I am trying to requery another form after adding new information to a table that a cboList is created from.
So, I have a combo box that has Sales personnel, and i have another form that lets me add sales personnel to the table of all the sales team. (Name, number, etc...)
But when I open up the main form (with the combo box of Sales Personnel) and then open the form to add new members, or edit the members, I can not seem to make a piece of code that will requery the main combo box.
I have tried the following with no success... -
Private Sub Command15_Click()
-
Dim cboSales As Control
-
cboSales = Forms!Main.Sales
-
cboSales.Requery
-
End Sub
-
Run time error '2465'
That doesn't work.
I tried... -
Private Sub Command15_Click()
-
Dim Forms!Main.Sales As Control
-
Forms!Main.Sales.Requery
-
-
End Sub
-
That one is just filled with errors.
I tried to do a: -
Private Sub Command15_Click()
-
Dim testReqSale As String
-
testReqSale = Forms!Main.Sales
-
DoCmd.Requery(testReqSale)
-
-
End Sub
-
Again, no success and more errors.
I suppose I could put a Requery command on the link to the form to add sales personnel, but that seems ineffective and the form could be possibly opened otherwise.
Dec 6 '06
11 38211 MSeda 159
Recognized Expert New Member
I know I'm jumping in kind of late here, but have you tried setfocus. In order to requery an object the form it's on has to have focus.
Try
Private Sub Command15_Click ()
Forms![Main].SetFocus
DoCmd.Requery "Sales"
End Sub
NeoPa 32,571
Recognized Expert Moderator MVP
I just place that in front of the other code, correct? I appreciate the help on this.
Yes.
But you should really have an
afterwards as well.
See the help on this (mainly posted above but in full from Access VBA Help) as it's very important to understand (and to use).
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
Me.RecordsetClone.FindFirst " = '" & Me! &
"'"
|
by: Tim Marshall |
last post by:
Here's the situation. A form, frmSetUp, with a subform control called
subExplain with a source object form frmSetUpSubDefineSides. The source
object is a bound form, displaying a few records, no edit, adds,
filters, etc, are permitted on the subform.
An add or edit button on the subform is clicked opening an unbound form,
frmSetUpSideAdd, (populated with values from the above subform if this
is an edit of an existing record) for data...
|
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 user enters the
last qualifying field on the main form.
In one case this works fine, the subform shows the data the user wants
to update -- which means showing all the data put in previously (ie
showing this via the requery and the continuous...
|
by: F. Michael Miller |
last post by:
I need to requery a subform from a third form and can't seem to get it to
work.
frmForm1 has frmAddress as a subform. The button cmdReviseAddress opens the
form frmUpdateAddress where all of my validation work is done and the new
record is added.
However, the new address is not being displayed in the subform.
If I use the command
|
by: Br |
last post by:
First issue:
When using ADPs you no longer have the ability to issue a me.refresh to
save the current record on a form (the me.refresh does a requery in an
ADP).
We usually do this before calling up another form or report that uses
some of the same data.
We came up with a work around that saves the current record's ID, does a
| |
by: BartonConstruction |
last post by:
Greetings all,
I have a main form (frmClients) with two subforms (subVisits)
(subAccount). I got the subforms to reflect what the main form is
showing by linking master and child fields (I think--newbie here). Now
I need the second subform (subAccount) to update when I add a visit in
the subVisits subform. I assume that the AfterUpdate would do it, but
I cant figure out what the code is to update another subform would be.
Not...
|
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. The command button passes
the criteria as a string to a query. A subform, which is based on this
query, shows the results of the search.
|
by: mrowe |
last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.)
I am having problems getting a requery to show up consistently on a couple of forms. I have...
|
by: Lyn |
last post by:
Hi,
I am using a form (FormA) to list the records in a recordset. In the FormA
footer, I have an "Add" command button that opens a new form (FormB)
modally which is used to input and save a new record to the table on which
the recordset is based.
On closing FormB after inputting a new record, I would like to
refresh/requery the listing in FormA automatically so that it includes the
new record. I don't seem to be able to get this to...
|
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...
|
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,...
| |
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...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |