PC Review


Reply
Thread Tools Rate Thread

Combo Box hell

 
 
=?Utf-8?B?U3RldmUgTW9zcw==?=
Guest
Posts: n/a
 
      8th Oct 2006
I am running Access 2007 (beta) and am having trouble displaying data. I
have a database with the following tables:

Product Info (with the following fields):-
ProductID (autonumber)
ProductName (Text) and Primarykey
UnitPrice (currency)

Invoice Details (with the following fields):-
Invoice ID (autonumber)
Invoice Number (text)
Invoice Date (Date/Time)
Job Completion Date (Date/Time)
RE: (Text)
Job Description (memo)

Invoice Product Info(with the following fields):-
InvoiceProductID (autonumber)
Invoice ID (number)
ProductID (number)
ProductName (text)
UnitPrice (currency)
QTY (number)

I have inserted the “Invoice Product Info” as a Subform Datasheet into
“Invoice Details”. What I am trying to achieve is, when I select
“ProductName” (Combobox) and choose from the list, that the “UnitPrice” is
automatically updated with the corresponding data from “Product Info” table.

I have the following Relationships :-
“ProductID” From “Product Info” and “Invoice Product Info”
“Invoice ID” From “ Invoice Details” and “Invoice Product Info”

I have selected RowSource for “ProductName (Combobox)” as “SELECT [Product
Info].ProductID, [Product Info].ProductName, [Product Info].UnitPrice FROM
[Product Info];”.

I have set the following Properties for the combobox:-
BoundColumn property to 1.
ColumnWidth to 0;;0

This used to display the middle column of data “ProductName”, but now
doesn’t, its blank.
I also inserted the following code as an event:-
Private Sub ProductName_AfterUpdate()
Me!UnitPrice = ProductName.Column(2)

To display the third column of data (UnitPrice) in the UnitPrice field.
This part has never worked.

What am I doing wrong.

 
Reply With Quote
 
 
 
 
Albert D. Kallal
Guest
Posts: n/a
 
      8th Oct 2006
Try re-building the combo box with the wizard.

Your format of:

> I have set the following Properties for the combobox:-
> BoundColumn property to 1.
> ColumnWidth to 0;;0


Hum, I I don't see a value for the 3 one?..why? you have 3 collums, you need
3 values?

Private Sub ProductName_AfterUpdate()

Me!UnitPrice = ProductName.Column(2)

end sub

Yes, that looks good. You should only need the ONE line of code above. I
would either fix your columns size, or simply delete the combo box, and use
the wizard to build the combo again.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)


 
Reply With Quote
 
=?Utf-8?B?U3RldmUgTW9zcw==?=
Guest
Posts: n/a
 
      9th Oct 2006
Thanks for that.
I have now got the Combo Box showing the right columns of information, but
the After_Update event still isnt inserting the UnitPrice from these columns
into the UnitPrice field. I have the Private Sub code, but no luck.
Any more suggestions.
cheers


"Albert D. Kallal" wrote:

> Try re-building the combo box with the wizard.
>
> Your format of:
>
> > I have set the following Properties for the combobox:-
> > BoundColumn property to 1.
> > ColumnWidth to 0;;0

>
> Hum, I I don't see a value for the 3 one?..why? you have 3 collums, you need
> 3 values?
>
> Private Sub ProductName_AfterUpdate()
>
> Me!UnitPrice = ProductName.Column(2)
>
> end sub
>
> Yes, that looks good. You should only need the ONE line of code above. I
> would either fix your columns size, or simply delete the combo box, and use
> the wizard to build the combo again.
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
>
>
>

 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      9th Oct 2006
"Steve Moss" <(E-Mail Removed)> wrote in message
news:352D5B29-DAB2-404E-9E5F-(E-Mail Removed)...
> Thanks for that.
> I have now got the Combo Box showing the right columns of information, but
> the After_Update event still isnt inserting the UnitPrice from these
> columns
> into the UnitPrice field. I have the Private Sub code, but no luck.
> Any more suggestions.


Is your after update code running? Put in a msgbox "after update" command to
test this....

It sounds likely your code is not running. test this!!!

Make sure you use the UI to enter the code.... (events tab - click on after
update field, then click on the ellipse -- the [...] button. Then choose
code....

If that property setting is blank, then the code you type in will NOT run...

so, is your after update event running?

(remember, this event will ONLY run when you CHANGE the value of the combo).

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)


 
Reply With Quote
 
=?Utf-8?B?U3RldmUgTW9zcw==?=
Guest
Posts: n/a
 
      10th Oct 2006
That didnt seem to work either. I have found a past question which was
answered by Ken Snell which has explained it.
http://www.mvps.org/access/forms/frm0058.htm

Many thanks for your help

Steve

"Albert D. Kallal" wrote:

> "Steve Moss" <(E-Mail Removed)> wrote in message
> news:352D5B29-DAB2-404E-9E5F-(E-Mail Removed)...
> > Thanks for that.
> > I have now got the Combo Box showing the right columns of information, but
> > the After_Update event still isnt inserting the UnitPrice from these
> > columns
> > into the UnitPrice field. I have the Private Sub code, but no luck.
> > Any more suggestions.

>
> Is your after update code running? Put in a msgbox "after update" command to
> test this....
>
> It sounds likely your code is not running. test this!!!
>
> Make sure you use the UI to enter the code.... (events tab - click on after
> update field, then click on the ellipse -- the [...] button. Then choose
> code....
>
> If that property setting is blank, then the code you type in will NOT run...
>
> so, is your after update event running?
>
> (remember, this event will ONLY run when you CHANGE the value of the combo).
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box hell or why do I get and error when I do this? DawnTreader Microsoft Access Form Coding 2 5th Nov 2009 05:53 AM
Re: Combo Box hell or why do I get and error when I do this? Dirk Goldgar Microsoft Access Form Coding 0 2nd Nov 2009 08:39 PM
More Combo hell =?Utf-8?B?U3RldmUgTW9zcw==?= Microsoft Access 21 12th Oct 2006 03:23 PM
Combo box hell again =?Utf-8?B?Sm9lIEM=?= Microsoft Access Forms 2 24th Jul 2006 05:02 AM
Cascading Combo Box Hell! S Jackson Microsoft Access Forms 2 13th Dec 2004 05:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 PM.