Dlookup (1 Viewer)

babakbe

New member
Local time
Today, 07:34
Joined
Jun 2, 2020
Messages
4
Hello
I have made a database for the medicines business and I need some help to complete it.

I have a form which is our entree table and there are medicine code,medicine name , buying price and some other informations on it.
I have another form that is our source for invoices as medicine code,medicine name,selling price ,date of sell and so on.

I have another form wich calls description and in this formI have a complete list of all medicines that we buy and sell.in this table we hace medicine code ,medicine name and some other informations .

the sources for all the forms are tables

now the question is that I want when I write or choose by a combo box a medicine code in entree form or selling from ,system finde the medicine name from description form and fill the medicine name autumatcally

I tried thin function by "Dlookup" but it doesn't work

may somebody please help me?
 

Ranman256

Well-known member
Local time
Today, 02:34
Joined
Apr 9, 2015
Messages
4,339
Dlookup does work, but put you didn't show us how you used it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:34
Joined
May 7, 2009
Messages
19,169
Add the med name, description, price on yout combo.

Combo are zero based. So combo.column(0) will refer to your med code.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:34
Joined
May 7, 2009
Messages
19,169
On the RowSource of your combo, create a query against your table:

Select medCode, medName, medDescription, UnitPrice from yourMedicineTablename;

Add code to the combos AfterUpdate:

Private sub combo_afterupdate()
Me.txtMedName=me.combo.column(1)
Me.txtDescription=me.combo.column(2)
Me.txtprice=me.combo.column(3)
End sub
 

babakbe

New member
Local time
Today, 07:34
Joined
Jun 2, 2020
Messages
4
On the RowSource of your combo, create a query against your table:

Select medCode, medName, medDescription, UnitPrice from yourMedicineTablename;

Add code to the combos AfterUpdate:

Private sub combo_afterupdate()
Me.txtMedName=me.combo.column(1)
Me.txtDescription=me.combo.column(2)
Me.txtprice=me.combo.column(3)
End sub

It not working but looks a very good soloution
I send you the link for my database if you take a look please

I would like to send you the link to take a look at data base but unfortunately forum dosn't accept the links!
 

missinglinq

AWF VIP
Local time
Today, 02:34
Joined
Jun 20, 2003
Messages
6,423
You need to
  1. Do a compile
  2. Remove any proprietary data
  3. ZIP the file up
  4. Attach it to a post
Linq ;0)>
 

Users who are viewing this thread

Top Bottom