M
M Davidson
Hello all,
I have a form (frmScores) that opens on the click event of a button on
another form (frmDORMain). frmScores is bound to tblScores. HERE'S THE
PROBLEM: I want to display the form 5 times in sequence (User enters a
record and then clicks new record 5x) and on each new record I want the
value of txtCategory to change like so, Cat1, Cat2, Cat3, Cat4, Cat5. Then
the form closes and another form (that already works) opens. The built in
navigation bar is disabled. (intentionally)
I have tried googling this... I can't find a similar situation. I've
checked my texts too. Any guidance will be greatly appreciated.
I know I need to declare a counter and base the category change off the
counter, but the problem is I'm having difficulty understanding what events
to tie the code to and which form or module to place the code in. (see my
feeble attempts below.)
Here's the table structure:
tblScores
txtScoreSerial 'autonumber
txtDORSerial 'autonumber linked M/1 to tblDORMain!txtDORSerial
txtScore ' the score
txtCategory 'the category of the score... that needs to cycle.
frmScores has 4 text boxes and a button:
txtScoreSerial
txtDORSerial
txtScore 'text box for score
txtCategory ' need it to cycle value
btnNext ' want it to save records and when all 5 are entered, close
frmScores and open next form.
I know I need to do something like:
Dim Counter as Integer
Counter = 1
Select Case Counter
Case 1
Me!txtCategory.value = "Cat1"
Case 2
Me!txtCategory.value = "Cat2"
Case 3
Me!txtCategory.value = "Cat3"
Case 4
Me!txtCategory.value = "Cat4"
Case 5
Me!txtCategory.value = "Cat5"
Case Else
DoCmd .closeForm... (well I forget that part... But I want to close
the form)
'I have that working elsewhere so I can cut and paste
that...
DoCmd.openForm 'open the narrative form... (the one that already
works)
End Select
' Then I need to increment the counter
Counter = Counter +1
<<>>
But where do I declare the counter? I have to set it to "1" the first time
but if I don't put that line "somewhere else", then everytime I run the
code, it'll just get "reset" back to "1." Right? And Where do I place the
Select Case ? Should I have a next button on the form and Increment the
counter on it's click, and rerun the case select on it's click?
This has got me whipped. Everything else is working but this chunk.
THanks,
Mike Davidson
I have a form (frmScores) that opens on the click event of a button on
another form (frmDORMain). frmScores is bound to tblScores. HERE'S THE
PROBLEM: I want to display the form 5 times in sequence (User enters a
record and then clicks new record 5x) and on each new record I want the
value of txtCategory to change like so, Cat1, Cat2, Cat3, Cat4, Cat5. Then
the form closes and another form (that already works) opens. The built in
navigation bar is disabled. (intentionally)
I have tried googling this... I can't find a similar situation. I've
checked my texts too. Any guidance will be greatly appreciated.
I know I need to declare a counter and base the category change off the
counter, but the problem is I'm having difficulty understanding what events
to tie the code to and which form or module to place the code in. (see my
feeble attempts below.)
Here's the table structure:
tblScores
txtScoreSerial 'autonumber
txtDORSerial 'autonumber linked M/1 to tblDORMain!txtDORSerial
txtScore ' the score
txtCategory 'the category of the score... that needs to cycle.
frmScores has 4 text boxes and a button:
txtScoreSerial
txtDORSerial
txtScore 'text box for score
txtCategory ' need it to cycle value
btnNext ' want it to save records and when all 5 are entered, close
frmScores and open next form.
I know I need to do something like:
Dim Counter as Integer
Counter = 1
Select Case Counter
Case 1
Me!txtCategory.value = "Cat1"
Case 2
Me!txtCategory.value = "Cat2"
Case 3
Me!txtCategory.value = "Cat3"
Case 4
Me!txtCategory.value = "Cat4"
Case 5
Me!txtCategory.value = "Cat5"
Case Else
DoCmd .closeForm... (well I forget that part... But I want to close
the form)
'I have that working elsewhere so I can cut and paste
that...
DoCmd.openForm 'open the narrative form... (the one that already
works)
End Select
' Then I need to increment the counter
Counter = Counter +1
<<>>
But where do I declare the counter? I have to set it to "1" the first time
but if I don't put that line "somewhere else", then everytime I run the
code, it'll just get "reset" back to "1." Right? And Where do I place the
Select Case ? Should I have a next button on the form and Increment the
counter on it's click, and rerun the case select on it's click?
This has got me whipped. Everything else is working but this chunk.
THanks,
Mike Davidson