Results 1 to 3 of 3
  1. #1
    empyrean is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    5

    Check box help in access 2003 [VB]

    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

  2. #2
    empyrean is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    5
    hellooo some one help me please...

  3. #3
    silverback is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    2
    Hi Empyrean
    I set up a test form with a checkbox and a command button so that, when the command button was clicked, I could check the value of the checkbox.
    My checkbox was called Check0. The VBA test I had was
    If Me.Check0 <> 0 Then
    Msgbox("Ticked")
    Else
    Msgbox("Unticked")
    End If

    This worked OK for me. I think it should do it for you.
    Hope this helps
    Silverback

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-29-2014, 09:58 PM
  2. Access 2003 Query Help?
    By Stirling Steve in forum Queries
    Replies: 1
    Last Post: 08-26-2009, 03:25 AM
  3. converting from Access 2003 to Access 2007
    By LawrenceLau in forum Access
    Replies: 6
    Last Post: 11-20-2008, 03:53 PM
  4. Replies: 1
    Last Post: 09-06-2006, 11:48 AM
  5. Help! Newbie needs help with Access 2003!!!
    By infernojericho in forum Access
    Replies: 0
    Last Post: 12-03-2005, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums