Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option group greyed out - but default set

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
Hi all

On a tabbed form I have an option group whos default setting is not showing. The control is unbound but and each of the options are greyed out until you select one. Anyone experienceing this problem?

Program Error
Programmers do it one finger at a time!
 
Your default (or current) value is set to null, making the options appear greyed out. One way around this is to set the default value to zero (if numeric) where zero is NOT one of your options.

OR Set it to another value that you want as a default.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
traingammer

It is already set to 1 as default. Yep I know... it's confused me as well!

btw it half 12 on saturnay morning here - lol burning the midnight oil to coin a phrase

Program Error
Programmers do it one finger at a time!
 
One is the default. Hmmm...

It's unbound. Is it updated on Current event, or is it completely unrelated to data in the current record?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Did you try replacing a new option group with this? Unusual things happen when the control is corrupted!
If the control was bound then you are in the new record. but the control is not bound!!

Zameer Abdulla
Visit Me (New Look & style)
 
there are infact three option groups side by side - all of which have a default value set to 1, al of these option groups are unbound and not part of any record. They are used to provide a value for vba CASE code.
Code:
Private Sub cmdshwrpt_Click()
On Error GoTo Err_cmdshwrpt_Click
'check all option boxes and select the report to run
Dim strReportName As String
Dim strwhere As String
Dim tdate As String
tdate = "#22/12/2004#"

If Me.frmPrtLabelType.Value = 1 Then
Select Case Me.opgselectrecords.Value
Case Is = 1
strwhere = "(tblOArequests.BcastDate)= " & tdate
Case Is = 2
strwhere = "((((tblOArequests.BcastDate) Between [Forms]![frmControlPanel2]![txtFromDate] And [Forms]![frmControlPanel2]![txtToDate]) AND ((tblOArequests.Printed)=0) AND ((tblOArequests.LabelType)='DVD')))"
Case Is = 3
strwhere = "qryDVDLabelsNotPrintedTODATE"
Case Is = 4
strwhere = "((tblOArequests.M) = True)"
End Select
Else
Select Case Me.opgselectrecords.Value
Case Is = 1
strwhere = "(tblOArequests.BcastDate)= " & tdate
Case Is = 2
strwhere = "((((tblOArequests.BcastDate) Between [Forms]![frmControlPanel2]![txtFromDate] And [Forms]![frmControlPanel2]![txtToDate]) AND ((tblOArequests.Printed)=0) AND ((tblOArequests.LabelType)='VHS')))"
Case Is = 3
strwhere = "qryVHSLabelsNotPrintedTODATE"
Case Is = 4
strwhere = "((tblOArequests.M) = True)"
End Select
End If

Select Case Me.frmPrtLabelType.Value
Case Is = 1
strReportName = "DVD label preview"
Case Is = 2
strReportName = "VHS label preview"
End Select

Select Case Me.frmPrtView.Value
Case Is = 1
'preview
DoCmd.OpenReport strReportName, acViewPreview, , strwhere
Case Is = 2
'print - this needs changing when ready
DoCmd.OpenReport strReportName, acViewPreview, , strwhere
End Select

'routine taken from vba forum - vbslammer
'Private Sub cmdOpenReport_Click()
'  DoCmd.OpenReport "rptInvoices", acViewPreview, , _
'    "[InvDate] BETWEEN #" & Me![BegDate] & "# AND #" & Me![EndDate] & "#"
'End Sub

Exit Sub
Err_cmdshwrpt_Click:
MsgBox Err.Description
End Sub
When any of them is selected they work without a problem and there setting remains set, but its just when the form is first opened none of them are selected!!

Program Error
Programmers do it one finger at a time!
 
all of which have a default value set to 1
Private Sub cmdshwrpt_Click()
On Error GoTo Err_cmdshwrpt_Click
'check all option boxes and select the report to run
Dim strReportName As String
Dim strwhere As String
Dim tdate As String
tdate = "#22/12/2004#"

If Me.frmPrtLabelType.Value = 2 Then
Select Case Me.opgselectrecords.Value
Case Is = 2
strwhere = "((((tblOArequests.BcastDate) Between [Forms]![frmControlPanel2]![txtFromDate] And [Forms]![frmControlPanel2]![txtToDate]) AND ((tblOArequests.Printed)=0) AND ((tblOArequests.LabelType)='VHS')))"
Case Is = 3
strwhere = "qryVHSLabelsNotPrintedTODATE"
Case Is = 4
strwhere = "((tblOArequests.M) = True)"
Case Else
strwhere = "(tblOArequests.BcastDate)= " & tdate
End Select
strReportName = "VHS label preview"
Else
Select Case Me.opgselectrecords.Value
Case Is = 2
strwhere = "((((tblOArequests.BcastDate) Between [Forms]![frmControlPanel2]![txtFromDate] And [Forms]![frmControlPanel2]![txtToDate]) AND ((tblOArequests.Printed)=0) AND ((tblOArequests.LabelType)='DVD')))"
Case Is = 3
strwhere = "qryDVDLabelsNotPrintedTODATE"
Case Is = 4
strwhere = "((tblOArequests.M) = True)"
Case Else
strwhere = "(tblOArequests.BcastDate)= " & tdate
End Select
strReportName = "DVD label preview"
End If

Select Case Me.frmPrtView.Value
Case Is = 2
'print - this needs changing when ready
DoCmd.OpenReport strReportName, acViewPreview, , strwhere
Case Else
'preview
DoCmd.OpenReport strReportName, acViewPreview, , strwhere
End Select

Exit Sub
Err_cmdshwrpt_Click:
MsgBox Err.Description
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top