By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Writing to variable tables - Access 2003

P: 5
I am trying to write to different tables depending on a user selected variable (ie: depending on the year selected, the data would goto the correct table). Am I able to setup my fields in my forms to reference a predefined variable, then from there write the data to the correct table? Any help or suggestions would be greatly appreciated.
Sep 6 '07 #1
Share this Question
Share on Google+
2 Replies


FishVal
Expert 2.5K+
P: 2,653
I am trying to write to different tables depending on a user selected variable (ie: depending on the year selected, the data would goto the correct table). Am I able to setup my fields in my forms to reference a predefined variable, then from there write the data to the correct table? Any help or suggestions would be greatly appreciated.
Hi, there.

If the tables have the same structure you may simply change Form.RecordSource after user has entered a year in let us say [ctlYear] control.

example, supposed tables are named: tblYear2001, tblYear2002 etc

Expand|Select|Wrap|Line Numbers
  1. Private Sub ctlYear_AfterUpdate()
  2.     Me.RecordSource = "tblYear" & ctlYear
  3. End Sub
  4.  
Sep 6 '07 #2

P: 5
dave,
thanks i'm playing around w/ that right now trying to get it to work for me. this doesnt really apply to your msg, but i thought i would post it since it gives a little more detail:
this is for a database i'm using for a golf outing. i have a table w/ static information (all participant data), then 2 tables set up w/ data that is specific to the year that are linked to the participants (sponsorships and donations). i need a way to have the sponsorship and donations be year specific. whereas the participant database will just keep growing and getting updated w/ any new info.

Hi, there.

If the tables have the same structure you may simply change Form.RecordSource after user has entered a year in let us say [ctlYear] control.

example, supposed tables are named: tblYear2001, tblYear2002 etc

Expand|Select|Wrap|Line Numbers
  1. Private Sub ctlYear_AfterUpdate()
  2.     Me.RecordSource = "tblYear" & ctlYear
  3. End Sub
  4.  
Sep 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.