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

Update a combobox

jim
Hi NG

I have a form in which I use a combobox - the content of the combobox depend
on the customername shown in a textbox.

Now my problem is that I want the content in the combobox to change every
time a record with a new customername is chosen.

I have tried to put in a me.controls("combobox").requery in afterupdate
event, and also a lot of other events, but it does not work.

Any surgestions?

Thx in advance
JJ
Nov 13 '05 #1
3 6642
OnCurrent of Form
(Assuming the combo box is used to find a customer record on the form)
Me!ComboBox = Me!CustomerID
or more simply
ComboBox = CustomerID
HTH

Phil
"jim" <ji*@get2net.dk> wrote in message
news:41*********************@dread11.news.tele.dk. ..
Hi NG

I have a form in which I use a combobox - the content of the combobox
depend
on the customername shown in a textbox.

Now my problem is that I want the content in the combobox to change every
time a record with a new customername is chosen.

I have tried to put in a me.controls("combobox").requery in afterupdate
event, and also a lot of other events, but it does not work.

Any surgestions?

Thx in advance
JJ

Nov 13 '05 #2
jim
Hi Phil

Thx for your answer - it works, but at the same time it comes up with a
warning - saying something like : "Microsoft Access can't find the macro
"Me!Kontaktperson = Me!Kundenavn" where Kontaktperson is the name of the
combobox, and kundenavn the name of the textbox which the combobox is
filtered after

"Phil Stanton" <di********@stantonfamily.co.uk> skrev i en meddelelse
news:41*********************@mercury.nildram.net.. .
OnCurrent of Form
(Assuming the combo box is used to find a customer record on the form)
Me!ComboBox = Me!CustomerID
or more simply
ComboBox = CustomerID
HTH

Phil
"jim" <ji*@get2net.dk> wrote in message
news:41*********************@dread11.news.tele.dk. ..
Hi NG

I have a form in which I use a combobox - the content of the combobox
depend
on the customername shown in a textbox.

Now my problem is that I want the content in the combobox to change every time a record with a new customername is chosen.

I have tried to put in a me.controls("combobox").requery in afterupdate
event, and also a lot of other events, but it does not work.

Any surgestions?

Thx in advance
JJ


Nov 13 '05 #3
Hi Jim

I am assuming you have a form of contacts and a field holding all sorts of
information including the Key of the Contact Table:- ContactID,
ContactName, Address, Phone etc

The SQL for the combo box should look something like
SELECT ContactPerson, ContactID FROM Contacts ORDER BY ContactPerson;
The combo box would have 2 columns, width say 3cms; 0cms and the bound
column Column2.
It is an UNBound Combo box

So the AfterUpdate of the ComboBox will say
Private Sub Kontaktperson_AfterUpdate

DoCmd.GotoControl "ContactID"
DoCmd.FindRecord Kontaktperson

End Sub
After selecting the contact from the box you will get to the correct
record.
On the other hand, if you run through the records using the next button on
the bottom of the form, by using the code I sent the other day, you will
highlight the name in the Combo Box.

This now changes to

Private Sub Form_Current()

Kontaktperson = CustomerID

End Sub

The On
"jim" <ji*@get2net.dk> wrote in message
news:41*********************@dread11.news.tele.dk. ..
Hi Phil

Thx for your answer - it works, but at the same time it comes up with a
warning - saying something like : "Microsoft Access can't find the macro
"Me!Kontaktperson = Me!Kundenavn" where Kontaktperson is the name of the
combobox, and kundenavn the name of the textbox which the combobox is
filtered after

"Phil Stanton" <di********@stantonfamily.co.uk> skrev i en meddelelse
news:41*********************@mercury.nildram.net.. .
OnCurrent of Form
(Assuming the combo box is used to find a customer record on the form)
Me!ComboBox = Me!CustomerID
or more simply
ComboBox = CustomerID
HTH

Phil
"jim" <ji*@get2net.dk> wrote in message
news:41*********************@dread11.news.tele.dk. ..
> Hi NG
>
> I have a form in which I use a combobox - the content of the combobox
> depend
> on the customername shown in a textbox.
>
> Now my problem is that I want the content in the combobox to change every > time a record with a new customername is chosen.
>
> I have tried to put in a me.controls("combobox").requery in afterupdate
> event, and also a lot of other events, but it does not work.
>
> Any surgestions?
>
> Thx in advance
> JJ
>
>



Nov 13 '05 #4

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

Similar topics

0
by: Marc | last post by:
Hi all, I have an application that uses a Pmw ComboBox to display a list that is dynamic. The user has the ability to add and delete items from the list at different points in the program. ...
1
by: Lumpierbritches | last post by:
Thank you in advance for any assistance, it is greatly appreciated. I would like to know if there's a way to update a combobox that is on a form when the table that it's linked to is updated, with...
1
by: thomaz | last post by:
When i make an update in my database, the modifications are showing in all TEXTBOX but i canīt see the new values in a combobox text. If i close the form and open it again the new values will...
4
by: al | last post by:
Greetings, As I understands it, SelectedValud of combobox reads its value from ValueMember property of the combobox. This doesn't work with me. What happens is just randome update. This is the...
4
by: Rob Kroese | last post by:
I've got a form with a datagrid that displays a list of items, along with several textboxes, comboboxes, etc., that display the details for the selected item. The columns in the datagrid and the...
3
by: dbuchanan | last post by:
Hello, (Windows forms - SQL Server) I fill my datagrid with a stored procedure that includes relationships to lookup tables so that users can see the values of the combobox selections rather...
1
by: fiaolle | last post by:
Hi I have tried to update my combobox with no luck. I add records to the table, the combobox has as Datasource, but I don't know how to update the combobox. I have tried updata the oledbadapter...
1
by: Sasa | last post by:
Hello, i have a problem with a query that update a table with the combo value and i have n combo. Ok, but when i don't insert any value in one combobox and run the query, all the value are insert...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
1
by: Rosie | last post by:
I have a main form with header info w/ 'tHeader' as the control source. I have a subform with 'tDetail' as a control source. They're strung together by a field named MA_ID. This works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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
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...

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.