Using a ComboBox selection to fill in other fields in form

P

PaulHilgeman

I know that I asked this question about two weeks ago, but I have now
finished all of the other items that I was working on in my database
and now I need to fix this one.

Things have changed a bit and I have studied the northwind.mdb file
quite a bit.

However, due to the way that I need to import data, I can not structure
my database that exact same way. In my main data table that contains
all of the jobs, each job must have the explicit data from all of it's
line items. I can not use the linked OrderID like they did in
Northwind.

So, I will be very explicit here in spelling it out to gain the most
clarity.

I have two tables. One is very very large. Each entry contains a
bunch of data about the address, phone etc. for that one job. Plus, it
has 30 fields devoted to description, rate and pay for 10 line items.

The important fields in the table are named as follows: The table is
named ORDERS

Item1Desc
Item1Rate
..
..
..


The smaller table contains the descriptions for each line item and the
rate associated with each one. The table is named LineItems

ProductID
ProductName
UnitPrice





The form goes like this:

The Name of the Combo Box is 'Item1Desc' It's DataSource is also
'Item1Desc'. It's RowSource is:

SELECT DISTINCT LineItems.ProductID, LineItems.ProductName FROM
LineItems;

The AfterUpdate Event is as follows:

Private Sub ITEM_1_DESCRIPTION_AfterUpdate()

Dim strFilter As String

strFilter = "Item1Desc = " & Me!Item1Desc

Me!Item1Rate = DLookup("UnitPrice", "LineItems", strFilter)

End Sub

The name of the TextBox to be filled in is "Item1Rate". It's
DataSource is "Item1Rate"

Now, I am not sure why the name "ITEM_1_DESCRIPTION" stuck on the
subroutine, that is what the ComboBox and the field in the table used
to be called, but I got sick of my own poor nomenclature.

The problem is that the correct names etc show up in the ComboBox, but
after I have selected the item, the rate does not fill in, it simply
stays at the default value of 0.

If anyone could help me solve this problem, I would be very very
greatful. I cant tell you how long I have spent on this!!!

Thank you all very much,
Paul Hilgeman
 

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