Share via

Loop threw continuous form using .tag

Anonymous
2016-01-16T12:08:20+00:00

Hello, I have a continuous form with a button and I need to check whether or not a chkbox is checked or not and if ANY of them are then run some code and if none are checked then give a message "You need to select a return before proceeding"

How can I do this? Thanks...

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

18 answers

Sort by: Most helpful
  1. Anonymous
    2016-01-16T16:38:22+00:00

    Ok I got rid of the error by removing the apostrophes but it doesnt run the code correct. It doesn't matter if I have check boxes checked or not checked on the form it goes directly to the Else part of the code

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-01-16T15:27:39+00:00

    Ok, Im getting a data type mismatch error 3464 and I know it has something to do with my string being a check box and the quotes or something around it maybe in strMissinSelected? Debuging takes me to the line: 

    rst.FindFirst strMissinSelected

    Private Sub cmdDeleteSelectedEntries_Click()

        Dim Cancel As Integer

        Dim strMissinSelected As String

        Dim rst As Recordset

        strMissinSelected = "ReleaseProduct = '" & Forms![frm_Hold]![frmsub_ProductHoldData].Form![chkRelease] & "'"

        Set rst = Me.frmsub_ProductHoldData.Form.RecordsetClone

        rst.FindFirst strMissinSelected

        If rst.NoMatch Then

            MsgBox "You need to select a return before proceeding"

            Exit Sub

        Else

            MsgBox "the boxes are checked run code"

            Cancel = fncRequiredReleaseSelectedEmail(Me)

        End If

    End Sub

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2016-01-16T13:29:02+00:00

    Forms do not hold data, they only display data. So you don't loop through a form, you loop through a recordset that represents the Recordsource of the form. 

    Towards that end you can use the Recordsetclone property of the form, or you can use a query that matches the recordsource. 

    Otherwise the loop is very standard.

    Dim rs As Recordset

    Set rs = Me.RecordsetClone  (or CurrentDb.OpenRecordset("SELECT...") )

    With rs

         .Movefirst

         Do While NOT .EOF

              If .Fields("filedname") = something

                  code to perform

              End If

              .MoveNext

          Loop

    End With

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2016-01-16T12:51:30+00:00

    Hi,

    you can use the recordsetclone to verify if almost one check-box are checked .

    Mimmo

    Was this answer helpful?

    0 comments No comments