How can I call an access header by using a variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with many columns Jan01 thru Dec 07
When I select a date I need to go to a particular column in the Table
ex. 12/29/2004 I need to go to Dec 04. I'm trying to do this in VBA code.
The follow is what I tried so far and does not work
Do While Not tbl_CurrentTransactions.EOF
x = 1
Do While x < 4
newval = "region" & x
tbl_TransHistory.AddNew
tbl_TransHistory![TransID] = tbl_CurrentTransactions![TransID]
tbl_TransHistory![Name] = tbl_CurrentTransactions![Name]
tbl_TransHistory![TransDate] = tbl_CurrentTransactions![TransDate]
tbl_TransHistory![Region] = tbl_CurrentTransactions![(newval)]
tbl_TransHistory.Update
x = x + 1
Loop

tbl_CurrentTransactions.MoveNext
 
I have a table with many columns Jan01 thru Dec 07

No you don't: you have a spreadsheet. If you rethink this design it really
will make the rest of the problem easy. In Access, you are working with a
database platform, so it will help yo uif you use database design rules.
When I select a date I need to go to a particular column in the Table
ex. 12/29/2004 I need to go to Dec 04. I am trying to do this in VBA
code.

Try rsMyRecordset("[Dec 04]")

Hope that helps


Tim F
 
Back
Top