return value based on combo box selection

K

klkropf

I have a combo box (cmbShipDate) in a form that is based on a table with drop
down values of ShipDate1, ShipDate2, ShipDate3, etc. I have created a text
box and I want the correct ship date to be displayed based on the combo box
selection. These ship dates are all stored in a table called tblOrder. I
thought I could use the DLookUp fuction, but I'm not doing something
correctly.
Thanks
 
J

Jeff Boyce

I don't understand what you mean by "based on a table with drop down
values".

And when you say the "ship dates are all stored in ... tblOrder", do you
mean that the selected ship date for each order is supposed to be stored
with that order's record in tblOrder?

I'm also unclear what you expected DLookUp() to do, and from where you are
trying to use it.

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
K

klkropf

The combo box Row Source is a table with the options ShipDate1, ShipDate2,
etc.

Each order can have multiple ship dates, so within the table tblOrder there
are fields called ShipDate1, ShipDate2, etc. that store the ship dates. When
I select ShipDate1 from the combo box I would like the date that is stored in
the field ShipDate1 from tblOrder to be displayed on the form (which may or
may not be blank) and that I can update it if I need to.

Thanks
 
J

Jeff Boyce

Sorry, I'm still not visualizing your data structure ... and in Access, it
all starts with the data!

Are you saying that your table has multiple fields, named [ShipDate1],
[ShipDate2], ...? If so, stop! That's how a spreadsheet would do it, but
Access is a relational database.

Are you saying that your tblOrders has multiple fields, named [ShipDate1],
....? If so, stop again! The table design you have is suitable for
spreadsheets, but will only cause you and Access considerable headaches
coming up with work-arounds to get around the fact that the data isn't
optimized for Access.

If you are saying that one Order can have multiple ShipDates, you have a
one-to-many relationship. Access handles that quite well, without resorting
to multiple (identical) fields...

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top