djpingpong
Programmer
- Jul 6, 2004
- 70
Hi,
I'm running Access 2002
I have created a form, which allows the end user to select a YEAR value (ie: 2006)
The first thing this form does is create a dynamic temp table (let's name it: tblTemp) which will pull in data according to the year selected.... so, it drops tblTemp, then re-creates tblTemp with new column names and gets populated again
One of the reason why tblTemp needs to be recreated each time is because of the Earnings history data. So if user selects 2006, then there'll be an earnings history from 2001-2006 and the field names will be named 2001_earnings, 2002_earnings,etc..
So after the OnLoad() process is completed creating this table, the form displays a datasheet of tblTmp. My problem is the form keeps the same field names as the first run. Meaning, if I ran 2006 the first time, i'd have 2006_earnings... 2001_earnings as field names... but the next time I run it and i select 2005, the field name "2006_earnings" still shows in the form and it's displaying #NAME as an error
I have tried the following, but it still didn't work for me:
what else can I do? I didn't think it would cause this much headache
I'm running Access 2002
I have created a form, which allows the end user to select a YEAR value (ie: 2006)
The first thing this form does is create a dynamic temp table (let's name it: tblTemp) which will pull in data according to the year selected.... so, it drops tblTemp, then re-creates tblTemp with new column names and gets populated again
One of the reason why tblTemp needs to be recreated each time is because of the Earnings history data. So if user selects 2006, then there'll be an earnings history from 2001-2006 and the field names will be named 2001_earnings, 2002_earnings,etc..
So after the OnLoad() process is completed creating this table, the form displays a datasheet of tblTmp. My problem is the form keeps the same field names as the first run. Meaning, if I ran 2006 the first time, i'd have 2006_earnings... 2001_earnings as field names... but the next time I run it and i select 2005, the field name "2006_earnings" still shows in the form and it's displaying #NAME as an error
I have tried the following, but it still didn't work for me:
Code:
me.recordsource = "SELECT * FROM tblTmp"
me.requery
me.refresh
what else can I do? I didn't think it would cause this much headache