Lookup table question

  • Thread starter ielmrani via AccessMonster.com
  • Start date
I

ielmrani via AccessMonster.com

Hi everyone,
I have a form with 2 text boxes linked to a table (table1). One is a drop
down box (DB1)to select user and one is text box (T1)to enter Department.
table1 has 2 fields: Name and Dept. I would like the department to be
entered based the name selected.

table1:

Name Dept
Ish NB
John BC
Bob NB

In the form if I select the name of Ish in the drop down (DB1) then The tex
box (T1)should show NB..If I select John then BC show..etc

Right now I am doing the following:

Private Sub DB1_AfterUpdate()
If Me.DB1 = "Ish" Or Me.DB1 = "Bob" Then
Me.T1= "NB"
Else
Me.T1 = "BC"
End If



If this is not clear please let me know. and Thanks is advance.
 
D

Damon Heron

Your combobox is based on the table1. So the row source of the box should
be table1. The column count (in properties), if your description of the
table is correct, is 2. Put column width as 1";0" and make the textbox
equal to DB1.column(1)
Private Sub DB1_AfterUpdate()
me.t1= db1.column(1)
end sub

Although this is simple, I am curious about why you have set up the form in
this way.

Damon
 
I

ielmrani via AccessMonster.com

thank you for your help. I solve it.

Damon said:
Your combobox is based on the table1. So the row source of the box should
be table1. The column count (in properties), if your description of the
table is correct, is 2. Put column width as 1";0" and make the textbox
equal to DB1.column(1)
Private Sub DB1_AfterUpdate()
me.t1= db1.column(1)
end sub

Although this is simple, I am curious about why you have set up the form in
this way.

Damon
Hi everyone,
I have a form with 2 text boxes linked to a table (table1). One is a drop
[quoted text clipped - 23 lines]
If this is not clear please let me know. and Thanks is advance.
 
I

ielmrani via AccessMonster.com

thank you for your help. I solve it.

Damon said:
Your combobox is based on the table1. So the row source of the box should
be table1. The column count (in properties), if your description of the
table is correct, is 2. Put column width as 1";0" and make the textbox
equal to DB1.column(1)
Private Sub DB1_AfterUpdate()
me.t1= db1.column(1)
end sub

Although this is simple, I am curious about why you have set up the form in
this way.

Damon
Hi everyone,
I have a form with 2 text boxes linked to a table (table1). One is a drop
[quoted text clipped - 23 lines]
If this is not clear please let me know. and Thanks is advance.
 

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