From: neil40 on 2 May 2010 19:56 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
From: Al Campagna on 2 May 2010 20:49 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" <neil.grantham(a)googlemail.com> wrote in message news:6e2a03e1-b541-43e0-a373-e1e3fa70e7ce(a)i9g2000yqi.googlegroups.com... > 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
From: Arvin Meyer [MVP] on 2 May 2010 20:53 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" <neil.grantham(a)googlemail.com> wrote in message news:6e2a03e1-b541-43e0-a373-e1e3fa70e7ce(a)i9g2000yqi.googlegroups.com... > 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
From: neil40 on 3 May 2010 19:49 On 3 May, 01:53, "Arvin Meyer [MVP]" <arv...(a)mvps.invalid> 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" <neil.grant...(a)googlemail.com> wrote in message > > news:6e2a03e1-b541-43e0-a373-e1e3fa70e7ce(a)i9g2000yqi.googlegroups.com... > > > > > 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.
|
Pages: 1 Prev: Access 2007 form won't open? Next: Delete not working in Access 2007 |