Connecting Tech Pros Worldwide Help | Site Map

Update a combobox

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 06:06 AM
jim
Guest
 
Posts: n/a
Default Update a combobox

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



  #2  
Old November 13th, 2005, 06:06 AM
Phil Stanton
Guest
 
Posts: n/a
Default Re: Update a combobox

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" <jim@get2net.dk> wrote in message
news:41e164be$0$141$edfadb0f@dread11.news.tele.dk. ..[color=blue]
> 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
>
>[/color]


  #3  
Old November 13th, 2005, 06:10 AM
jim
Guest
 
Posts: n/a
Default Re: Update a combobox

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" <discussion@stantonfamily.co.uk> skrev i en meddelelse
news:41e19829$0$108$65c69314@mercury.nildram.net.. .[color=blue]
> 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" <jim@get2net.dk> wrote in message
> news:41e164be$0$141$edfadb0f@dread11.news.tele.dk. ..[color=green]
> > 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[/color][/color]
every[color=blue][color=green]
> > 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
> >
> >[/color]
>
>[/color]


  #4  
Old November 13th, 2005, 06:10 AM
Phil Stanton
Guest
 
Posts: n/a
Default Re: Update a combobox

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" <jim@get2net.dk> wrote in message
news:41e44433$0$200$edfadb0f@dread11.news.tele.dk. ..[color=blue]
> 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" <discussion@stantonfamily.co.uk> skrev i en meddelelse
> news:41e19829$0$108$65c69314@mercury.nildram.net.. .[color=green]
>> 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" <jim@get2net.dk> wrote in message
>> news:41e164be$0$141$edfadb0f@dread11.news.tele.dk. ..[color=darkred]
>> > 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[/color][/color]
> every[color=green][color=darkred]
>> > 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
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.