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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

entering data into a changing field

Status
Not open for further replies.

tziviak2

MIS
Jul 20, 2004
53
US
I have a table with fields 1-31 (for days of months) I have code running through to determine what info to enter into what day of the month (not all fields get a value) so I have a variable that I ca set for 1-31-how can I code so that the value should go into the right field my code is now :
rsAttendance.Fields(dayfield) = Code
dayfield(value between 1-30)
this code puts the value (code) into the field-(but if the variable is 5 -it puts the value -code-into the 6th column (0,1,2,3,4,5)-I could subtract one from it-but how do I make it put it into the right field (if I would have a field with a text and not a number)
I hope I made the question clear-otherwise let me know
thank you
 
You really have fields with pure numeric names ?
If your fields are named, say Day1 .. Day31, you may try this:
rsAttendance.Fields("Day" & dayfield) = Code

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
To be sure, try this:
MsgBox "dayfield=" & dayfield & "," & rsAttendance.Fields("" & dayfield).Name

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top