If one field is ??? then make this field read ???

G

Guest

I'll try to explain what I'm looking for.

Table - has two fields 'Reason Code' and 'Reason Desc'

Form - two fields one with a drop down to choose which 'Reason Code'

I am trying to make the other field auto populate based on what the 'Reason
Code' field is populated with. If 'Reason Code' = 1 then from the table
under 'Reason Desc' I want the corresponding description to autopopulate the
second field with 'Send', etc.

Reason Code Reason Desc
1 Send
2 Mail
3 Fax
 
G

Guest

One more detail - on the form there is a unique number from another table
identifying each customer.
 
J

Jeff Boyce

Gina

You don't mention whether the [Reason Desc] control (on forms, they're
called "controls", not fields -- fields are in tables and queries) is bound
to any underlying field, or is unbound.

One approach would be to leave it unbound, and add the following in an event
procedure for the AfterUpdate event of your combo box:

Me![Reason Desc] = Me![Reason Code].Column(1)

This requires that your combo box (?[Reason Code]) have at least two
columns, the first of which is your code and the second is your Description.
Note that the .Column(1) is "zero-based".

On the other hand, and much more simply, if you create a two-column combo
box, with the code and the description, then set the column width of the
first column to zero, the combo box will display the [Reason Desc], but
store the [Reason Code].

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Jeff,

Thank you for your response. I tried your suggestion and many others. With
the assistance of a co-worker we were able to get it to work. Although, I
think your suggestion may have proved to be a simpler method and at another
time I would like to take more time to think about it.

Again, thank you for your time.
--
Gina


Jeff Boyce said:
Gina

You don't mention whether the [Reason Desc] control (on forms, they're
called "controls", not fields -- fields are in tables and queries) is bound
to any underlying field, or is unbound.

One approach would be to leave it unbound, and add the following in an event
procedure for the AfterUpdate event of your combo box:

Me![Reason Desc] = Me![Reason Code].Column(1)

This requires that your combo box (?[Reason Code]) have at least two
columns, the first of which is your code and the second is your Description.
Note that the .Column(1) is "zero-based".

On the other hand, and much more simply, if you create a two-column combo
box, with the code and the description, then set the column width of the
first column to zero, the combo box will display the [Reason Desc], but
store the [Reason Code].

Regards

Jeff Boyce
Microsoft Office/Access MVP


Gina said:
I'll try to explain what I'm looking for.

Table - has two fields 'Reason Code' and 'Reason Desc'

Form - two fields one with a drop down to choose which 'Reason Code'

I am trying to make the other field auto populate based on what the
'Reason
Code' field is populated with. If 'Reason Code' = 1 then from the table
under 'Reason Desc' I want the corresponding description to autopopulate
the
second field with 'Send', etc.

Reason Code Reason Desc
1 Send
2 Mail
3 Fax
 

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