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  

After Event to automatically fill



 
 
Thread Tools Display Modes
  #1  
Old May 3rd, 2010, 12:56 AM posted to microsoft.public.access.forms
neil40[_2_]
external usenet poster
 
Posts: 28
Default After Event to automatically fill

Hi

I have a form for inputting data to a table that does as follows:
Combo44
SELECT tblseason.seasonfld FROM tblseason GROUP BY
tblseason.seasonfld;
After Event:
Private Sub Combo44_AfterUpdate()
Combo46.Requery
End Sub
So I can type in a year (EG 1950) and this updates Combo46 with the
relevant choices
Combo46
SELECT tblseason.leaguefld FROM tblseason WHERE
(((tblseason.seasonfld)=[Forms]![MultiLgeInput]![Combo44]));

tblseason consists of the fields: seasonfld, leaguefld and rankfld

In my form, I would like to have a field/control automatically fill in
the relevant data from rankfld (IE no choice) after selecting the
leaguefld from it's combo

I'd much appreciate some help on what type of control I need on the
form and any code I need to accomplish this

Many thanks
Neil
  #2  
Old May 3rd, 2010, 01:49 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default After Event to automatically fill

Neil40,
I would suggest using more relevant names for your form objects, such as
cboSeason, and cboLeague. It makes it much easier to read and understand
the code if meaningful names are used.
I'll refer to combo46 as cboLeague...
Make cboLeague a two column combo...
League | Rank
I'll also assume that Rank is associated with League, so it's not
necessary
to save the Rank value... just display it for the user. Given that you have
League,
you can always re-associate the correct Rank in any subsequent query, form,
or
report, and this text control will alwats display the Rank assocaited with
the League
selected in cboLeague.
Place an unbound text control (ex. name [Rank]) on the form with a
ControlSource of...
= cboLeague.Column(1)
Whenever you select a League in cboLeague, the associated Rank will
"display"
in the text control.

If you must "save" the rank value to your table, then place a bound text
control,
bound to your Rank field, on the form. Use the AfterUpdate event of
cboLeague...
Rank = cboLeague.Column(1)
(Combo columns are numbered left to right, 0, 1, 2, 3, 4, etc...)
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"neil40" wrote in message
...
Hi

I have a form for inputting data to a table that does as follows:
Combo44
SELECT tblseason.seasonfld FROM tblseason GROUP BY
tblseason.seasonfld;
After Event:
Private Sub Combo44_AfterUpdate()
Combo46.Requery
End Sub
So I can type in a year (EG 1950) and this updates Combo46 with the
relevant choices
Combo46
SELECT tblseason.leaguefld FROM tblseason WHERE
(((tblseason.seasonfld)=[Forms]![MultiLgeInput]![Combo44]));

tblseason consists of the fields: seasonfld, leaguefld and rankfld

In my form, I would like to have a field/control automatically fill in
the relevant data from rankfld (IE no choice) after selecting the
leaguefld from it's combo

I'd much appreciate some help on what type of control I need on the
form and any code I need to accomplish this

Many thanks
Neil



  #3  
Old May 3rd, 2010, 01:53 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default After Event to automatically fill

In the combo's after update, or the form's after update event, push the data
from the relevant combo to a textbox:

Me.txtWhatever = Me.combo46.Column(2)

Column 2 is the 3rd column in a 0 based index of columns. Adjust to you own
control names. BTW, it is a good idea to rename controls so you know what
the represent, so instead of combo46, you'd do better with cboSeason (or
whatever you choose).
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"neil40" wrote in message
...
Hi

I have a form for inputting data to a table that does as follows:
Combo44
SELECT tblseason.seasonfld FROM tblseason GROUP BY
tblseason.seasonfld;
After Event:
Private Sub Combo44_AfterUpdate()
Combo46.Requery
End Sub
So I can type in a year (EG 1950) and this updates Combo46 with the
relevant choices
Combo46
SELECT tblseason.leaguefld FROM tblseason WHERE
(((tblseason.seasonfld)=[Forms]![MultiLgeInput]![Combo44]));

tblseason consists of the fields: seasonfld, leaguefld and rankfld

In my form, I would like to have a field/control automatically fill in
the relevant data from rankfld (IE no choice) after selecting the
leaguefld from it's combo

I'd much appreciate some help on what type of control I need on the
form and any code I need to accomplish this

Many thanks
Neil



  #4  
Old May 4th, 2010, 12:49 AM posted to microsoft.public.access.forms
neil40[_2_]
external usenet poster
 
Posts: 28
Default After Event to automatically fill

On 3 May, 01:53, "Arvin Meyer [MVP]" wrote:
In the combo's after update, or the form's after update event, push the data
from the relevant combo to a textbox:

Me.txtWhatever = Me.combo46.Column(2)

Column 2 is the 3rd column in a 0 based index of columns. Adjust to you own
control names. BTW, it is a good idea to rename controls so you know what
the represent, so instead of combo46, you'd do better with cboSeason (or
whatever you choose).
--
Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access

"neil40" wrote in message

...



Hi


I have a form for inputting data to a table that does as follows:
Combo44
SELECT tblseason.seasonfld FROM tblseason GROUP BY
tblseason.seasonfld;
After Event:
Private Sub Combo44_AfterUpdate()
* *Combo46.Requery
End Sub
So I can type in a year (EG 1950) and this updates Combo46 with the
relevant choices
Combo46
SELECT tblseason.leaguefld FROM tblseason WHERE
(((tblseason.seasonfld)=[Forms]![MultiLgeInput]![Combo44]));


tblseason consists of the fields: seasonfld, leaguefld and rankfld


In my form, I would like to have a field/control automatically fill in
the relevant data from rankfld (IE no choice) after selecting the
leaguefld from it's combo


I'd much appreciate some help on what type of control I need on the
form and any code I need to accomplish this


Many thanks
Neil- Hide quoted text -


- Show quoted text -


Al and Arvin

Many thanks for the replies
I went with Al's bound text box as I DO want to save this to a table
and it's now working a treat

Thanks again
Neil.
 




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 01:00 PM.


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