Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to variable tables 1

Status
Not open for further replies.
Sep 6, 2007
11
US
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.
 
Without setting up separate forms for each user, what you need to do is use unbound forms (ie without a defined recordset and controls bound to fields) then build an SQL insert statement based on the data entered and the current user. This can have different table names in it.
You then run this against the database.

I have to ask - why? Would having one table with an extra column indicating the user that added it be far simpler.

John
 
this is a database i'm using for a golf outing. i have a table w/ static information (all participant data), then 2 table set up w/ data that is specific to the year that are linked to the users(sponsorships and donations). i need a way to have the sponsorship and donations be year specific. whereas the user database will just keep growing and getting updated w/ any new info.
 
i didn't see where i could edit my last post so here's my edited version:

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.
 
I'd do as follows:

One table for participants (as you have),

One for sponsorships and donations. Put a year of donations (or you could calculate this by putting a date of donation/sponsorship in the table) and pull the year from that.

Why make your life more difficult than it needs to be?

John
 
Ok, got it all up to par. Thank you for all of the help.
The only thing I’m having an issue w/ is the filtering. i have several forms that are pop-ups. i would like to have on the main menu form a drop down to select the year they would like to work w/. This would set the filtration for all of the following forms/reports from there on out. I am not able to figure out how to carry that year variable over from form to form or form to report off the original form.
 
Look at the WhereClause argument of DoCmd.OpenForm to pass this across as a where clause.
Alternatively, you can pass this criteria across as part of OpenArgs and then write your own code to filter down.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top