Option group auto open - Repost Need Help Soon, Please-thanks!

J

Jani

My option group for opening forms works correctly. However, when I open a
form, close the form, and am then back to the page with the option group and
try to reselect the same form, it won't do it. I need to open a different
form, back to the option group page, then can select it. Below is the code
that I have in After Update event. Any help would be much appreciated!
Thanks, Jani

Private Sub MainSwitchboard_AfterUpdate()
Dim strFormName As String

Select Case Me.MainSwitchboard
Case 1
strFormName = "frm_CMMS_NonPMTasks"
Case 2
strFormName = "frm_CMMSPrevMaintTable"
Case 3
strFormName = "frm_CMMS_PMTaskList_AddNew"
Case 4
strFormName = "frm_CMMS_PMTaskList_Maintenance"
Case 5
strFormName = "frm_CMMSMainForm_PMTasks"
Case 6
strFormName = "frm_CMMS_Reports"
End Select

DoCmd.OpenForm strFormName
End Sub
 
D

Damon Heron

Add this after the line "DoCmd.OpenForm strFormName"---
me.mainswitchboard.value=0


Damon
 
C

Carl Rapson

You should use something other than an option group for this, since once an
option is selected it can't be re-selected unless a different option is
selected first (the exact behavior you're seeing). I prefer a menu of command
buttons for opening forms like you're decribing; a command button can be
clicked as many times in a row as you wish.

If you insist on continuing to use an option group for this, you will need
to "clear" the option group after your form is opened by setting its value to
Null:

DoCmd.OpenForm strFormName
MainSwitchboard = Null

Disclaimer: I haven't actually tried setting an option group control to Null
like this, but it seems like it should work. I still recomment the command
button approach.

Carl Rapson
 

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