473,842 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox Requery Onchange

Gil
Hello,
I want a combox to requery each time it is being changed.

What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"

The code looks like this:

Private Sub combo1_Change()
Me.combo1.Reque ry
End Sub

When i do this i get the following error:
"Your must save the current field before you run the requery action."

How can i refresh the rowsource as I am typing in the combo1?
Maybe there is another aproach to this all together...
Thanks for Any help,
Gil

Nov 25 '05 #1
6 8236
Gil wrote:
Hello,
I want a combox to requery each time it is being changed.

What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"

The code looks like this:

Private Sub combo1_Change()
Me.combo1.Reque ry
End Sub

When i do this i get the following error:
"Your must save the current field before you run the requery action."

How can i refresh the rowsource as I am typing in the combo1?
Maybe there is another aproach to this all together...
Thanks for Any help,
Gil


Don't know if this aircode will work but...
Dim strSource as String
Dim strValue As String
Dim intPos As String

strValue = Me.combo1

strSource = Me.Combo1.Rowso urce
'remove Where statement
intPos = instr(strSource ," Where ")
If intPos > 0 the strSource = left(strSource, intPos)

strSource = strSource & " Where field1 = '" & Me.Combo1 & "'"
Me.Combo1.Rowso urce = strSource
'you could check and see if there are any rows returned...then
Me.Combo1 = strValue

Nov 25 '05 #2
Gil wrote:

What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"

The code looks like this:

Private Sub combo1_Change()
Me.combo1.Reque ry
End Sub When i do this i get the following error:
"Your must save the current field before you run the requery action."

This is because as you are entering characters, you are changing the
text property of the combo box and not the value.

Of course, I don't know what the purpose of this is within your
application, but I don't think this is a wise idea.

It sounds like you are using the combo for a dual purpose, to narrow the
number of possible choices down AND to make a selection. In my own
(emphasize "my own") experience, users are easily confused by controls
which perform multiple and different functions.

I do the following in a successful app, although it's against a list
box, but it's the same principle.

I put in a separate text box, say txtSearchEnter. To avoid the message
you mention, I then put in a second, _invisible_, text box, say
txtSearch. The purpose of the second text box is to save each change
made to the text. So, in the visible text box into which the user
enters text, I have the on change event as follows:

Private Sub txtSearchEnter_ Change()

Me.txtSearch = Me.txtSearchEnt er.Text

Me.Combo1.Reque ry

End Sub

The combo1 (I think you ought to rename this control name to something
that's a bit more intuitive, like cboChoice or something, but that's
your call) rowsource would then be:

SELECT * FROM tbl WHERE field1 Like txtSearch & "*"

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 25 '05 #3
Try this and see if it does what you want ---
1. Remove the Change event code
2. Remove the Where clause from the rowsource and add an ascending sort on
the field you want to display in the combobox
3. Under the Data tab in Properties, change the Autoexpand property to Yes
4. Put the following code in the Enter event of the combobox:
Me.NameOfCombob ox.Dropdown

Now try entering something in the combobox.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

Over 1000 Access users have come to me for help. My fees are very
reasonable.

"Gil" <gi*******@gmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Hello,
I want a combox to requery each time it is being changed.

What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"

The code looks like this:

Private Sub combo1_Change()
Me.combo1.Reque ry
End Sub

When i do this i get the following error:
"Your must save the current field before you run the requery action."

How can i refresh the rowsource as I am typing in the combo1?
Maybe there is another aproach to this all together...
Thanks for Any help,
Gil

Nov 25 '05 #4

"PC Datasheet" <no****@nospam. spam> wrote in message
news:XB******** ********@newsre ad3.news.atl.ea rthlink.net...
PC Datasheet
[garbage snipped]


The CDMA charter prohibits advertising and Steve is the only consultant that
refuses to adhere to that charter. There are literally hundreds of competent
Access consultants available. Many post regularly in this newsgroup, others
can easily be located by googling or visiting guru.com.

Either Steve's advertising should be stopped or the CDMA charter should be
amended to permit it. Permitting Steve to continue advertising punishes the
many ethical consultants who contribute here but don't advertise.

Nov 25 '05 #5
Randy,

Why don't you follow the advise of David Fenton ---

"Stop. I'm on the verge of killfiling the bunch of you who are
polluting the newsgroup with theis bitchfest."

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

Over 1000 Access users have come to me for help. My fees are very
reasonable.


"PleaseStopAdve rtising" <no****@pcdatas heet.com> wrote in message
news:TQ******** ********@newssv r24.news.prodig y.net...

"PC Datasheet" <no****@nospam. spam> wrote in message
news:XB******** ********@newsre ad3.news.atl.ea rthlink.net...
PC Datasheet
[garbage snipped]


The CDMA charter prohibits advertising and Steve is the only consultant
that
refuses to adhere to that charter. There are literally hundreds of
competent
Access consultants available. Many post regularly in this newsgroup,
others
can easily be located by googling or visiting guru.com.

Either Steve's advertising should be stopped or the CDMA charter should be
amended to permit it. Permitting Steve to continue advertising punishes
the
many ethical consultants who contribute here but don't advertise.

Nov 25 '05 #6
On 25 Nov 2005 09:23:49 -0800, "Gil" <gi*******@gmai l.com> wrote:
Hello,
I want a combox to requery each time it is being changed.

What i am trying to do is have the combo box filter to the text being
entered.
The combo1 rowsource is:
SELECT * FROM tbl WHERE field1 Like combo1 & "*"

The code looks like this:

Private Sub combo1_Change()
Me.combo1.Reque ry
End Sub

When i do this i get the following error:
"Your must save the current field before you run the requery action."

How can i refresh the rowsource as I am typing in the combo1?
Maybe there is another aproach to this all together...
Thanks for Any help,


See if this doesn't have what you need:

http://allenbrowne.com/ser-32.html

mike
Nov 26 '05 #7

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

Similar topics

3
2646
by: Pete | last post by:
I have a combobox which is used to select records, which is satisfactory at the moment. However, a second user is going to start using this database and there will be 1600 records. This makes the combobox a little unfeasable as searching through this many names would be difficult and time-consuming. I would like the user to be able to select a group of people from a first combobox, and then when he goes to the second, only the names of
0
1391
by: luci | last post by:
Hello I've developed several data access pages and I searched for the same problems in different internet pages but I never got back a usable answer. Here are my questions: 1) How is it possible to requery a single combobox in a data access page? Of course it's possible to requery the whole data access page (e.g. MSODSC.DataPages(0).Requery or window.location.reload(true)) But
3
3862
by: rmatteson | last post by:
I am trying to figure out how to clear all items from a combobox (Access 2002). On my form, I have to comboboxes. Combobox 2 is populated with a set of child data dependent on the parent data item selected in Combobox 1. This is done through the .AddItem method of Combobox 2 looping through the recordset. This works fine, until --> the data item in the Combobox 1 is changed, then Combobox 2 just appends the "new" related child data...
8
12121
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
5
8117
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 requeried to immediately reflect these changes. The problem is that I can't requery in the OnDblClick event of the ComboBox because the event completes once the subform is launched. I guess I could requery the combobox from the Close event of the...
3
4277
by: ApexData | last post by:
COMBOBOX REFRESH DILEMMA ' I have been working for hours trying to figure out how to requery a combobox in a subform, from a Popup form ' that this subform had launched. Basically, I designed a form that pops up when the user dbl-clicks a combobox. ' This popup form displays the table that the combobox uses. The user can change the content, and the combobox ' rowsource in-turn will change. This all works great in my mainform, but...
34
20263
by: bitsnbytes64 | last post by:
Hi, I've been having a similar issue to what is described in the "refresh a form" post with a ComboBox that is not being refreshed after adding a new value on a seperate form. The second form is being opened via the standard DoCmd call. I've tried adding Requery in AfterUpdate, Form_Current, etc. to no avail.... The test form has the combobox and a command button. Here's my test code: Private Sub cmdAddCatgCd_Click() On Error GoTo...
3
5801
by: Eric | last post by:
Hi. I have this Combobox name 'Origin' that contains all states and countries. I would like to create two Radio buttons (State and Country) that when you select State, the combobox will query only the states and vice versa for country. I've create two columns in the Origin table (OriginState and OriginCountry) and set the data type to 'bit' to differentiate the two. How would I query the combobox when a radiobutton is selected? Thanks.
4
4970
by: EManning | last post by:
I have a combobox whose rowsource is a union query. This query displays a person's name in "lastname, firstname" format and in "firstname lastname" format. The query results look like this: Mouse, Mickey Mickey Mouse When a person is added, the querys' underlying recordset is updated in the NotInList event. I can't figure out how to refresh the combobox to display the new person. I get the standard error message that the
0
9872
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
9715
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
10945
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
10612
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
10314
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
9453
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
7858
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
5696
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...
2
4089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.