Unbound option group question

S

steve a

I have a option group which is unbound as i use it to enter text via:

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[ward] = Choose([optward], "First Text", "Second Text", "Third Text",
"forth text", "fifth text", "sixth text") please ignore text wrap

end sub

however since adding this code, when i use a command button to move onto the
next new record the toggle buttons do not reset, and the selection remains.
how do I reset the option group to be as a new entry?
Your help is appreciated as always,
steve
 
D

Dale Fye

I'm not sure whether setting the option groups default value will change when
you go to a new record or not, since it is not bound. Try that first.

If that doesn't work, then in the forms Current event, set the value of the
option group to whatever you want it to be. You will also have to call the
afterupdate event, as that won't fire when you change the controls value via
code.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
S

steve a

Hi dale
It's actually part of a cascade where i use the toggle buttons to filter a
list box:
see complete code below.

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[Ward] = Choose([optward], "Dalby", "Fenton", "Kirby", "Farndale",
"Kyme", "Boston")

Dim strCountry As String
Select Case optward.Value
Case 1
strCountry = "dalby"
Case 2
strCountry = "fenton"
Case 3
strCountry = "kirby"
Case 4
strCountry = "farndale"
Case 5
strCountry = "kyme"
Case 6
strCountry = "boston"
End Select
lstpt.RowSource = "Select tblAll.name " & _
"FROM tblAll " & _
"WHERE tblAll.ward = '" & strCountry & "' " & _
"ORDER BY tblAll.name;"
End Sub

so when i click on my command button with code:

Private Sub combined_Click()
On Error GoTo Err_combined_Click

Me.[DTstamp] = Now()
Me.[User name] = CurrentUser
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToRecord , , acNewRec


Exit_combined_Click:
Exit Sub

Err_combined_Click:
MsgBox Err.Description
Resume Exit_combined_Click

so when i click the "command button, the dat gets added fine, and the list
box ends up blank. However the toggle button stays in shadow and cannot be
clicked again, but the others can and the filter works fine, then the
original toggle can be selected again....
I was hoping there would be some code i could put in with the command button
to "refresh/reset" the option box toggles with out effecting anything else!

Many thanks
Steve

--
steve adlam


Dale Fye said:
I'm not sure whether setting the option groups default value will change when
you go to a new record or not, since it is not bound. Try that first.

If that doesn't work, then in the forms Current event, set the value of the
option group to whatever you want it to be. You will also have to call the
afterupdate event, as that won't fire when you change the controls value via
code.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



steve a said:
I have a option group which is unbound as i use it to enter text via:

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[ward] = Choose([optward], "First Text", "Second Text", "Third Text",
"forth text", "fifth text", "sixth text") please ignore text wrap

end sub

however since adding this code, when i use a command button to move onto the
next new record the toggle buttons do not reset, and the selection remains.
how do I reset the option group to be as a new entry?
Your help is appreciated as always,
steve
 
D

Dale Fye

Try adding a line like:

me.optWard = Null

after the gotorecord line in your command button click event.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.

steve a said:
Hi dale
It's actually part of a cascade where i use the toggle buttons to filter a
list box:
see complete code below.

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[Ward] = Choose([optward], "Dalby", "Fenton", "Kirby", "Farndale",
"Kyme", "Boston")

Dim strCountry As String
Select Case optward.Value
Case 1
strCountry = "dalby"
Case 2
strCountry = "fenton"
Case 3
strCountry = "kirby"
Case 4
strCountry = "farndale"
Case 5
strCountry = "kyme"
Case 6
strCountry = "boston"
End Select
lstpt.RowSource = "Select tblAll.name " & _
"FROM tblAll " & _
"WHERE tblAll.ward = '" & strCountry & "' " & _
"ORDER BY tblAll.name;"
End Sub

so when i click on my command button with code:

Private Sub combined_Click()
On Error GoTo Err_combined_Click

Me.[DTstamp] = Now()
Me.[User name] = CurrentUser
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToRecord , , acNewRec


Exit_combined_Click:
Exit Sub

Err_combined_Click:
MsgBox Err.Description
Resume Exit_combined_Click

so when i click the "command button, the dat gets added fine, and the list
box ends up blank. However the toggle button stays in shadow and cannot be
clicked again, but the others can and the filter works fine, then the
original toggle can be selected again....
I was hoping there would be some code i could put in with the command button
to "refresh/reset" the option box toggles with out effecting anything else!

Many thanks
Steve

--
steve adlam


Dale Fye said:
I'm not sure whether setting the option groups default value will change when
you go to a new record or not, since it is not bound. Try that first.

If that doesn't work, then in the forms Current event, set the value of the
option group to whatever you want it to be. You will also have to call the
afterupdate event, as that won't fire when you change the controls value via
code.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



steve a said:
I have a option group which is unbound as i use it to enter text via:

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[ward] = Choose([optward], "First Text", "Second Text", "Third Text",
"forth text", "fifth text", "sixth text") please ignore text wrap

end sub

however since adding this code, when i use a command button to move onto the
next new record the toggle buttons do not reset, and the selection remains.
how do I reset the option group to be as a new entry?
Your help is appreciated as always,
steve
 
S

steve a

Brilliant. works a treat..
Thank you very much!

--
steve adlam


Dale Fye said:
Try adding a line like:

me.optWard = Null

after the gotorecord line in your command button click event.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.

steve a said:
Hi dale
It's actually part of a cascade where i use the toggle buttons to filter a
list box:
see complete code below.

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[Ward] = Choose([optward], "Dalby", "Fenton", "Kirby", "Farndale",
"Kyme", "Boston")

Dim strCountry As String
Select Case optward.Value
Case 1
strCountry = "dalby"
Case 2
strCountry = "fenton"
Case 3
strCountry = "kirby"
Case 4
strCountry = "farndale"
Case 5
strCountry = "kyme"
Case 6
strCountry = "boston"
End Select
lstpt.RowSource = "Select tblAll.name " & _
"FROM tblAll " & _
"WHERE tblAll.ward = '" & strCountry & "' " & _
"ORDER BY tblAll.name;"
End Sub

so when i click on my command button with code:

Private Sub combined_Click()
On Error GoTo Err_combined_Click

Me.[DTstamp] = Now()
Me.[User name] = CurrentUser
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToRecord , , acNewRec


Exit_combined_Click:
Exit Sub

Err_combined_Click:
MsgBox Err.Description
Resume Exit_combined_Click

so when i click the "command button, the dat gets added fine, and the list
box ends up blank. However the toggle button stays in shadow and cannot be
clicked again, but the others can and the filter works fine, then the
original toggle can be selected again....
I was hoping there would be some code i could put in with the command button
to "refresh/reset" the option box toggles with out effecting anything else!

Many thanks
Steve

--
steve adlam


Dale Fye said:
I'm not sure whether setting the option groups default value will change when
you go to a new record or not, since it is not bound. Try that first.

If that doesn't work, then in the forms Current event, set the value of the
option group to whatever you want it to be. You will also have to call the
afterupdate event, as that won't fire when you change the controls value via
code.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



:


I have a option group which is unbound as i use it to enter text via:

Private Sub optward_AfterUpdate()
On Error Resume Next

Me.[ward] = Choose([optward], "First Text", "Second Text", "Third Text",
"forth text", "fifth text", "sixth text") please ignore text wrap

end sub

however since adding this code, when i use a command button to move onto the
next new record the toggle buttons do not reset, and the selection remains.
how do I reset the option group to be as a new entry?
Your help is appreciated as always,
steve
 

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