Cycling Through Every Record in a table/subform When the booleancolumn is selected

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

Hi,

I have a subform based on a recordset. I have a boolean column where
the user can select the checkbox to the left of the record. If the
user selects the checkbox, I want to check to see if the field exactly
to the right (DeptID) equals a field on my form. If it does, then
that fabulous. If not, then I want to uncheck all boolean values in
the table and display a message box. How would I do that?
 
N

nouveauricheinvestments

Hi,

I have a subform based on a recordset. I have a boolean column where
the user can select the checkbox to the left of the record. If the
user selects the checkbox, I want to check to see if the field exactly
to the right (DeptID) equals a field on my form. If it does, then
that fabulous. If not, then I want to uncheck all boolean values in
the table and display a message box. How would I do that?

This is what I have so far and it is giving me the messagebox saying
it is the EOF. What should I do differently?
Public Function ToCheckDept()

Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset

Dim MySQL As String
MySQL = "SELECT [Pending Tickets].DeptID, [Pending
Tickets].ResearchTicket FROM [Pending Tickets] WHERE [Pending
Tickets].ResearchTicket=True;"
RS.Open MySQL, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
With RS
If Not .EOF Then
.MoveFirst
Else
MsgBox "It's saying EOF"
Exit Function
End If
End With


Select Case RS.Fields(0)
Case Is = Forms![ViewOpenTickets]![TSDeptID]
Exit Function
Case Else
MsgBox "It is working so far"
End Select
Set RS = Nothing

End Function
 
N

nouveauricheinvestments

I have a subform based on a recordset. I have a boolean column where
the user can select the checkbox to the left of the record. If the
user selects the checkbox, I want to check to see if the field exactly
to the right (DeptID) equals a field on my form. If it does, then
that fabulous. If not, then I want to uncheck all boolean values in
the table and display a message box. How would I do that?

This is what I have so far and it is giving me the messagebox saying
it is the EOF. What should I do differently?
Public Function ToCheckDept()

Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset

Dim MySQL As String
MySQL = "SELECT [Pending Tickets].DeptID, [Pending
Tickets].ResearchTicket FROM [Pending Tickets] WHERE [Pending
Tickets].ResearchTicket=True;"
RS.Open MySQL, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
With RS
If Not .EOF Then
.MoveFirst
Else
MsgBox "It's saying EOF"
Exit Function
End If
End With

Select Case RS.Fields(0)
Case Is = Forms![ViewOpenTickets]![TSDeptID]
Exit Function
Case Else
MsgBox "It is working so far"
End Select
Set RS = Nothing

End Function

nevermind, that function doesn't work. It evaluates everything
false.
 

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