View Full Version : timer on tab pages
logarcia 11-13-2007, 07:00 AM Hi im trying to see if there is a way to put a timer in tab pages. so that when the time expires it changes to another tab. I have it working fine with the command button. I have like 20 tabs all hidden until the user clicks the cmd. Now is there a way to put a timer? I know that i can do it with the Form_timer, but that dont seem to work with tabs.
thanx
pbaldy 11-13-2007, 07:40 AM There is no timer on the tab control, only the form itself. I assume you could put the code behind the button in the timer event. You say it doesn't work; what goes wrong?
logarcia 11-13-2007, 07:48 AM well i put the code in te cmd but i dont know how to put a timer in the cmd cuz i have to be when the form open.
here is what i want. i want this first form to open so that the user enter the info, like name, student number and so on. when the user clicks the button another form opens with the student name on top and one question in an option group. when the time expires or if the user click nex, another form opens with the student number on top again and another questios with a new timer. I had that working fine, the only thing was that when i opened the table to look at the results it appears as if the student took the test, equal number of row. Example 20 form, then 20 records for that one student. I dont want that, i want all the quesitons in the same row, record...
i got it with the tabs, i only need a timer so it change from tab to tab by timer
The_Doc_Man 11-13-2007, 08:45 AM The way to do that is to put a timer in the form.
You change tabs by doing a tab-name.SetFocus, which brings that tab-page to the top. You prevent changes back to the other tabs by having an OnClick event on each tab-page's selection control (essentially, the labeled part of the tab) so that you "filter" whether the clicked tab should be allowed up.
I might suggest something simple, like a set of flags that you track. Every time you change tabs, store the current tab name in some variable in the class module's declarations area. Or some state-variable that says, OK, tab 1, tab 2, tab 3, etc... your call as to details. Disallow a change to a lower tab number than currently stored in the variable. Each tab would, of course, have to know its assigned tab number. But this is not hard since you have separate OnClick events for each tab selector control.
Write a subroutine to implement the NEXT TAB action that you described. Have it update your state variable. Maybe have it store the time spent on that tab in a separate little tracking table. It is up to you as to how you approach this. Then, have your timer code trigger a call to the NEXT function - AND have the displayed NEXT button also call that same code. Use the NEXT TAB subroutine called from both places. So that way, it is the common subroutine that actually implements NEXT TAB, and you just trigger it from two places.
OK, your next issue is one that I'm going to probably upset you, but... hey, it is the price you pay for exposing your ideas to others.
Your ONE STUDENT, ONE RECORD, x QUESTIONS per record design is not normalized. What do you do on the day that you change from 20 questions to 21 questions? OR 19 questions? And then back to 20 questions? Access is actually doing what it SHOULD do in this case.
Access is NOT a spreadsheet, but what you say you want is typical spreadsheet thinking. Flat-file concepts. No need for a relational ANYTHING when you think in those terms.
Read up on Database Normalization via Access Help, Wikipedia.ORG, or Google searches to learn about Database Normalization. Those 20 questions and the response record you described would be what we call a REPEATING GROUP - which violates something we call First Normal Form.
Much bad karma in doing that kind of de-normalization. Serious inflexibility down the road. MANY bad heaches when trying to change to a new test format. Take the word of an old campaigner. You don't want to go that way long-term.
logarcia 11-13-2007, 09:31 AM so in other words I cant do what i want unless i have it the way it is now. One student and 20 records for that student?? I thought I was doing something wrong. Im not that good with acces im still learning, and i know a bit of visual basic, so i was trying to create something like that...
is there something maybe mixing access with excel? or something to create like a test in one of those programs?? please let me know
thanx alot
The_Doc_Man 11-13-2007, 12:24 PM The presence of multiple records is a by-product of normalization. Don't confuse storage with display. There are ways to create the data display you might want as a report, but storage-wise, normalization says your structure should be
tblStudent: StudentID (Prime Key), student info, etc.
tblTest: TestID (Prime Key), test date, expected number of answers, etc.
tblTestQues: QuestionID (Prime Key), TestID (shows applicable test), TheQuestion, TheRightAnswer
tblTestAnsw: QuestionID (foreign key), studentID (foreign key), TestID (optional; foreign key), TheAnswer, WasRight (as a Yes/No)
You can get student details via a join between the TestAnsw table and the student table. You can get test details via a join between the optional TestID in the TestAnsw table and the test table. This is OPTIONAL in the sense that you could omit it and join to the questions, from which you could derive the test info through a second join; or you could choose to optimize slightly by joining directly from the answer table. If you DO optimize, then you can get test scores via simple Summation query to do group-by on testID and studentID.
To see how you transpose the answers into a spread-sheet-like display, search this forum for keyword "TRANSPOSE" to see how others have approached the problem.
logarcia 11-13-2007, 01:00 PM :eek: ok with that u just said there i noticed that i dont know nothing about access.. I guess im gonna leave it the way it is, no timer and working fine, i just needed a timer but I guess I need to learn alot from access
thanx anyway
boblarson 11-13-2007, 01:19 PM i just needed a timer but I guess I need to learn alot from access
Yes, sometimes what SOUNDS easy, or simple, is actually not when you get to actually trying to implement it. Just like it is easy to implement something that is easy for the programmer, but difficult for the user or you can implement something easy for the user but it is very difficult for the programmer. I tend to work on the assumption that I am going to have to do the difficult work so that the user doesn't have to.
logarcia 11-14-2007, 06:30 AM yeah. I thought it was a simple thing doing a test like form. Actually is working the way I want I just neer a timer, like a code o r something that runs everytime the tab is visible. Right now i have 20 tabs, 19 of then not visible until the user click a button. But no timer,which is going to do the same as the button only it would be time. But I guess im gonna stay with the button if i dont find the code for timer.
thanx
|
|