Check box help in access 2003 [VB]

empyrean

Registered User.
Local time
Today, 04:30
Joined
Oct 20, 2009
Messages
17
I would like to use check box in my form and when you click i need one command to happen and if you dont click it i need another command to happen. i tried using checkbox.value but i am getting error saying Method or data member not found. please help me with right syntax. Colored code is where i declare check box


Private Sub btnRefine_Click()
Dim i As Int
Dim strTemp As String
Dim strFil As String
Dim strM As String
Dim str As String

strM = Me.txtMoiLevel.Value
str = Me.hInpChk.Value
strFil = "ExptlNber IN ('" & Me.txtHyb & "','" & Me.txtSur & "') OR " & _
"(Sur = '" & Me.txtSur & _
"' AND ComN IN (" & str & ")" & _
" AND Moi Between -" & strM & " And " & strM & ")"

If Me.lstChk.ItemsSelected.Count > 0 Then
strTemp = "("
For i = 0 To Me.lstChk.ListCount - 1
If Not lstChk.Selected(i) Then
strTemp = strTemp & "'" & Me.lstChck.Column(0, i) & "',"
End If

Next i
strFil = strFil & " AND ComN IN " & Left(strTemp, Len(strTemp) - 1) & ")"
End If

If Me.CheckPed.ControlType = vbChecked Then
DoCmd.OpenReport "rptPer_Refine", acViewPreview, , strFil, acWindowNormal

Else
DoCmd.OpenReport "rptPerf", acViewPreview, , strFil, acWindowNormal
End If

DoCmd.Maximize
DoCmd.Close acForm, Me.Name
End Sub
 
hellooo some one help me please...

First off, please remember that the people here offer their help for free. Being impaitent will get more frowns and scowels that help. It's only been an hour since you posted. Give it some time.

Now, as to your problem, try this:

Code:
[B][COLOR=#8b0000]If Me.CheckPed = -1 Then
DoCmd.OpenReport "rptPer_Refine", acViewPreview, , strFil, acWindowNormal

Else
DoCmd.OpenReport "rptPerf", acViewPreview, , strFil, acWindowNormal
End If[/COLOR][/B]
[B][COLOR=#8b0000]
[/COLOR][/B]

the value of a check box is either Yes (-1) or No (0) as far as I know.
 

Users who are viewing this thread

Back
Top Bottom