M
Manuel
I have a search form that retrieves records in a subform based on criteria
entered into unbound text boxes on the main/parent form. The subform is tied
to a SQL recordset that contains a field called “Selectâ€. The field’s
datatype is Yes/No.
On the main form I have a button called “View Selected†with the following
code in the OnClick event:
Private Sub cmdViewSelected_Click()
On Error GoTo Err_cmdViewSelected_Click
Dim i As Integer
i = DCount("ProjectId", "ProjectTbl", "[Select] = " & True)
If i = 0 Then
MsgBox "No Record(s) Selected", vbInformation
Exit Sub
End If
DoCmd.OpenForm "MainForm", , , "[Select] = " & True
Exit_cmdViewSelected_Click:
Exit Sub
Err_cmdViewSelected_Click:
MsgBox Err.Description
Resume Exit_cmdViewSelected_Click
End Sub
Basically, the user has the option to select a subset of the records
returned by the search by clicking the “Select†checkbox and then clicking
the “View Selected†button, which opens another form (“Main Formâ€) that
displays more details.
I plan to clear the “Select†field via an Update query, inserted in both the
parent form’s OnClose event and in the above code.
DoCmd.RunSQL "UPDATE ProjectTbl SET ProjectTbl.[Select] = False WHERE
(((ProjectTbl.[Select])=True))"
The problem is that there are a number of users using the database and I see
the potential of one or more users checking the “Select†checkbox for
different records and then clicking the “View Selected†button and having
unexpected results/records returned in the detailed form (unexpected to the
user, since he/she just expects to have the records he/she selected display
in the detailed form).
Is there a better way to have the “View Selected†functionality within my
search form than the way I’m doing it? Perhaps by using the “clone†method
to clone the recordset or by creating another workspace. I’m just not sure
of where to being with the coding.
Your assistance is greatly appreciated!
Thanks,
Manuel
entered into unbound text boxes on the main/parent form. The subform is tied
to a SQL recordset that contains a field called “Selectâ€. The field’s
datatype is Yes/No.
On the main form I have a button called “View Selected†with the following
code in the OnClick event:
Private Sub cmdViewSelected_Click()
On Error GoTo Err_cmdViewSelected_Click
Dim i As Integer
i = DCount("ProjectId", "ProjectTbl", "[Select] = " & True)
If i = 0 Then
MsgBox "No Record(s) Selected", vbInformation
Exit Sub
End If
DoCmd.OpenForm "MainForm", , , "[Select] = " & True
Exit_cmdViewSelected_Click:
Exit Sub
Err_cmdViewSelected_Click:
MsgBox Err.Description
Resume Exit_cmdViewSelected_Click
End Sub
Basically, the user has the option to select a subset of the records
returned by the search by clicking the “Select†checkbox and then clicking
the “View Selected†button, which opens another form (“Main Formâ€) that
displays more details.
I plan to clear the “Select†field via an Update query, inserted in both the
parent form’s OnClose event and in the above code.
DoCmd.RunSQL "UPDATE ProjectTbl SET ProjectTbl.[Select] = False WHERE
(((ProjectTbl.[Select])=True))"
The problem is that there are a number of users using the database and I see
the potential of one or more users checking the “Select†checkbox for
different records and then clicking the “View Selected†button and having
unexpected results/records returned in the detailed form (unexpected to the
user, since he/she just expects to have the records he/she selected display
in the detailed form).
Is there a better way to have the “View Selected†functionality within my
search form than the way I’m doing it? Perhaps by using the “clone†method
to clone the recordset or by creating another workspace. I’m just not sure
of where to being with the coding.
Your assistance is greatly appreciated!
Thanks,
Manuel