By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Update a combobox

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.