Tab control indexing

C

Cameron

I have a tab control being used on a sub form that has 10 tabs. Within each
tab there is aproximately 10 questions that the user will need to fill out
for entry of a record. what I need to do is when the user clicks off their
responces the code underneath needs to send the currently active location of
which tab the user is entering data in and then also which question they hace
clicked on. what would be the most productive way to do this? i thought maybe
a select case statement, but would like to use something a bit more automated
rather then code out each question's responce.
 
M

mscertified

"needs to send the currently active location"

what does this mean? send where? and why?

normally this data would be saved in whatever table that is bound to the form.

-Dorian
 
J

John W. Vinson

I have a tab control being used on a sub form that has 10 tabs. Within each
tab there is aproximately 10 questions that the user will need to fill out
for entry of a record. what I need to do is when the user clicks off their
responces the code underneath needs to send the currently active location of
which tab the user is entering data in and then also which question they hace
clicked on. what would be the most productive way to do this? i thought maybe
a select case statement, but would like to use something a bit more automated
rather then code out each question's responce.

STOP!!!!

It sounds like you're starting your database design with the Form. That's
backwards!

Get your *table* design set up correctly first, and then build your forms to
fit the table - not vice versa. Tables store data; forms are just windows,
tools to let you manage the data in tables. You're NOT entering answers on a
form; you're entering answers *into a table* via a form.

For survey data, consider Duane Hookum's "At Your Survey":
http://www.rogersaccesslibrary.com/Otherdownload.asp?SampleName='At Your Survey 2000'

or

Roger Carlson's Training Registration database:
http://www.rogersaccesslibrary.com/download3.asp?SampleName=TrainingRegistration.mdb
 
C

Cameron

Um, yah. I started with my tables first.

Have a pimary table that holds my record key, and the date. In my second
table I have a Primary key, and a secondary key that links to my Primary
table. I then need to be able to keep track of which catagory, which
question, and what the responce was to that question from the form. I have to
do this because the user wants to report on questions answered.

So I have catagories setout on seperate pages in a tab control, each page
holds a specific number of questions based on the catagory the user is
entering data into. And dependng on the responce of the user (Yes, No or N/A)
that should all be recorded in the secondary table.

All I really want to know is how I could best build a function that would
gather the data based on the page the user was on and pop it into the table.
I certainly do not want to be writting massive amounts of code for a
proceedure that could be looped based on the indexing of the tab control and
the index of the yes/no questions.

But maybe it is apparent that I can not accurately convey what I am trying
to do and what I am requesting.
 
J

John W. Vinson

So I have catagories setout on seperate pages in a tab control, each page
holds a specific number of questions based on the catagory the user is
entering data into. And dependng on the responce of the user (Yes, No or N/A)
that should all be recorded in the secondary table.

So these are all unbound controls (nothing in their Control Source)? You're
therefore painting yourself into a corner; you *must* write code to populate
the table. Sorry I didn't catch that you were intentionally doing so in your
first post!
All I really want to know is how I could best build a function that would
gather the data based on the page the user was on and pop it into the table.
I certainly do not want to be writting massive amounts of code for a
proceedure that could be looped based on the indexing of the tab control and
the index of the yes/no questions.

I'd leave the Tab Control out of the code entirely. What you might do is
encode each textbox's target field in its Tag property. You could then loop
through the Form's Controls collection, checking each to see if it has a Tag
value, and if so putting its Value into the appropriate field. The tab control
wouldn't come into the equation at all.
 
C

Cameron

I couldn't really utilize control sourcing on the controls because even thou
the questions are all different, they still are uniquely exactly the same
data and thus did not want to complicate the database by breaking up the
catagory records into seperate tables. I expected to just write code to
populate the table.

Basically, want to leverage the primary secondary key relationship to filter
out the records needed for the form should a user want to look at specific
date entries. However, when a user builds a new entry have to code in the
background to press the various IDs to the secondary table based on the
intially primary table ID.

Is there a way to utilize a "control array" to intiate the records as the
user clicks on specific tabs and then on questions in that tab? For example.

Clicking on the assessment tab triggers the code to assign in the secondary
table a field under catagory of number 5, and then as the user clicks on
questions in that tab the question field would get number 1 or 2 or 3 and the
approprate answer in the answer field. Or would I be better off to have a
linking table with the catagories?

Just do not like to introduce tons of redundent data.
 
J

John W. Vinson

I couldn't really utilize control sourcing on the controls because even thou
the questions are all different, they still are uniquely exactly the same
data and thus did not want to complicate the database by breaking up the
catagory records into seperate tables. I expected to just write code to
populate the table.

Ok... I'm now officially confused. Could you post the structure of your table
or tables, fieldnames and relationships?
Basically, want to leverage the primary secondary key relationship to filter
out the records needed for the form should a user want to look at specific
date entries. However, when a user builds a new entry have to code in the
background to press the various IDs to the secondary table based on the
intially primary table ID.

And a Subform won't suffice...?
Is there a way to utilize a "control array" to intiate the records as the
user clicks on specific tabs and then on questions in that tab? For example.

Clicking on the assessment tab triggers the code to assign in the secondary
table a field under catagory of number 5, and then as the user clicks on
questions in that tab the question field would get number 1 or 2 or 3 and the
approprate answer in the answer field.

Well, yes, with code in the Tab Control's Change event (which fires when the
user selects a tab page), and code in each checkbox's AfterUpdate event. You
could have a common function and set each change event to call it:

=ProcessAnswer()

and use Screen.ActiveControl in the ProcessAnswer function to determine which
box was checked.
Or would I be better off to have a
linking table with the catagories?

That would *certainly* be a more normalized way to do it, and require far less
code.
 

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