A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access Form



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2006, 03:18 PM posted to microsoft.public.access.forms
Lindascp
external usenet poster
 
Posts: 1
Default Access Form

In my form, I am trying to set up (2) fields that pull info from a list- the
1st field would have a combo box and pull a dept #, the 2nd field I want to
automatcially update based on the value that matches the 1st field. So ex:
the 1st field I would select a dept id based on a drop down list and the 2nd
field I want updated with the dept name that coincides with the dept id in
the 1st field.

--
ls
  #2  
Old December 15th, 2006, 04:26 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default Access Form

You didn't ask a question or give any details about your data, so it's kind
of difficult to give advice. How is your 1st field (the combo box) being
populated (where is the list of data coming from)? If it's from a table or
query, you can add the dept name as a 2nd column in the combo box, then in
the AfterUpdate event of the combo box you can set the 2nd field value to
the value in column 1 of the 1st field; for example,

txtField2 = cboField1.Column(1).

Alternatively, you can DLookUp to set the 2nd field to the dept name based
on the dept id in the 1st field, something like

txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" & cboField1)

Again, this would go in the AfterUpdate event of the 1st field (the combo
box). Note that I've used made-up names for the fields and controls; you
will need to put in your actual field and control names.

Hope these suggestions help,

Carl Rapson

"Lindascp" wrote in message
...
In my form, I am trying to set up (2) fields that pull info from a list-
the
1st field would have a combo box and pull a dept #, the 2nd field I want
to
automatcially update based on the value that matches the 1st field. So ex:
the 1st field I would select a dept id based on a drop down list and the
2nd
field I want updated with the dept name that coincides with the dept id in
the 1st field.

--
ls



  #3  
Old December 15th, 2006, 05:49 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Access Form

First idea, good
Alternative idea, bad

Well, not bad - it will work, but why pay the overhead for the DLookup that
is not necessary if you use the first idea.

"Carl Rapson" wrote:

You didn't ask a question or give any details about your data, so it's kind
of difficult to give advice. How is your 1st field (the combo box) being
populated (where is the list of data coming from)? If it's from a table or
query, you can add the dept name as a 2nd column in the combo box, then in
the AfterUpdate event of the combo box you can set the 2nd field value to
the value in column 1 of the 1st field; for example,

txtField2 = cboField1.Column(1).

Alternatively, you can DLookUp to set the 2nd field to the dept name based
on the dept id in the 1st field, something like

txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" & cboField1)

Again, this would go in the AfterUpdate event of the 1st field (the combo
box). Note that I've used made-up names for the fields and controls; you
will need to put in your actual field and control names.

Hope these suggestions help,

Carl Rapson

"Lindascp" wrote in message
...
In my form, I am trying to set up (2) fields that pull info from a list-
the
1st field would have a combo box and pull a dept #, the 2nd field I want
to
automatcially update based on the value that matches the 1st field. So ex:
the 1st field I would select a dept id based on a drop down list and the
2nd
field I want updated with the dept name that coincides with the dept id in
the 1st field.

--
ls




  #4  
Old December 18th, 2006, 06:09 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default Access Form

Just trying to cover all bases. Some people might find the DLookUp method
easier to implement than the multiple columns in a combo box. Of course, I
may have only confused the OP.

Carl Rapson

"Klatuu" wrote in message
...
First idea, good
Alternative idea, bad

Well, not bad - it will work, but why pay the overhead for the DLookup
that
is not necessary if you use the first idea.

"Carl Rapson" wrote:

You didn't ask a question or give any details about your data, so it's
kind
of difficult to give advice. How is your 1st field (the combo box) being
populated (where is the list of data coming from)? If it's from a table
or
query, you can add the dept name as a 2nd column in the combo box, then
in
the AfterUpdate event of the combo box you can set the 2nd field value to
the value in column 1 of the 1st field; for example,

txtField2 = cboField1.Column(1).

Alternatively, you can DLookUp to set the 2nd field to the dept name
based
on the dept id in the 1st field, something like

txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" &
cboField1)

Again, this would go in the AfterUpdate event of the 1st field (the combo
box). Note that I've used made-up names for the fields and controls; you
will need to put in your actual field and control names.

Hope these suggestions help,

Carl Rapson

"Lindascp" wrote in message
...
In my form, I am trying to set up (2) fields that pull info from a
list-
the
1st field would have a combo box and pull a dept #, the 2nd field I
want
to
automatcially update based on the value that matches the 1st field. So
ex:
the 1st field I would select a dept id based on a drop down list and
the
2nd
field I want updated with the dept name that coincides with the dept id
in
the 1st field.

--
ls






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.