Use String variable to access field

J

jschping

Hi,

I have a Schedules with 5 fields, Monday, Tuesday, Wed, etc

I want to write a VB subroutine to access the specified field depending on a
variable.

So if I have a string variable Day, I want the subroutine to be able to
retrieve Schedules!Daym meaning to retrieve the value in the field for
whatever Day happens to be. Will Schedules!Day work? What syntax should I use?

Is it different if I want to get a dataset and then access it?

Thanks!
 
J

Jeff Boyce

If you have a table with fields named "Monday", and "Tuesday", and ..., you
don't have a table, you have a spreadsheet!

Both you & Access will have to work overtime to overcome 'sheet data ...
Access is optimized for well-normalized data.

You may want to spend some time brushing up on normalization and relational
database design...

Good luck!

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top