Checking all subform entries to find a match?

D

Daniel

Hello,

I have a form who's current event verifies what fields have information and
control the visibility of other fields based on the information.

the basic code is like

********
If faq_IsUserInGroup("Leads", CurrentUser()) = True Then
Me.Stress_Signature.Enabled = False
Me.Stress_Date.Enabled = False
Me.Weight_Signature.Enabled = False
Me.Weight_Date.Enabled = False
'Me.Check_Signature.Enabled = False
'Me.Check_Date.Enabled = False
*******
My problem is that the fields that once where on the main form are now part
of a continous subform and an extra Status (Approved, Rework) field was added
to the subform. I need to know how to detect if the subform has an entry
who's status is "Approved" if so then.... How can I loop through the entries
of the subform?!

Thanks,

Daniel
 
A

Alex Dybenko

Daniel,
you can either open recordset, based on subform's recordsetclone and loop
through it, or just run a select SQL, which query for required status, based
on current values on main subform
 
D

Daniel

I was hoping to avoidgoing to the table if possible. Can this be done while
the main form is open and already filtered to the proper recordsets. Is there
a way to search through the actively display record of a subform? Or maybe I
didn't understand your previous message?!

Daniel
 
A

Alex Dybenko

yes, you can get a recordset using recordsetclone:

set rst=me.SubformControlName.form.recorsetclone

then loop through it:

if not rst.eof then rst.movefirst
do until rst.eof
....
rst.movenext
loop
 
D

Daniel

Alex,

I'm trying to apply what you wrote in your last message but seem to have a
little snag.

I have as follows:

***********
Dim rst As Recordset
Set rst = Forms![Drawing Management Frm]![Drawing History Frm
sous-formulaire]![Drawing Status Tbl subform]![DMU Dates Tbl
Subform].Form.RecordsetClone
***********

but I keep getting a type mismatch at the set statement. could you point
out my mistake please.

Thank you

Daniel
 
A

Alex Dybenko

Hi Daniel,
try to declare rst as dao.Recordset (and make sure you have reference to DAO
in menu tools-references)


--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com




Daniel said:
Alex,

I'm trying to apply what you wrote in your last message but seem to have a
little snag.

I have as follows:

***********
Dim rst As Recordset
Set rst = Forms![Drawing Management Frm]![Drawing History Frm
sous-formulaire]![Drawing Status Tbl subform]![DMU Dates Tbl
Subform].Form.RecordsetClone
***********

but I keep getting a type mismatch at the set statement. could you point
out my mistake please.

Thank you

Daniel


Alex Dybenko said:
yes, you can get a recordset using recordsetclone:

set rst=me.SubformControlName.form.recorsetclone

then loop through it:

if not rst.eof then rst.movefirst
do until rst.eof
....
rst.movenext
loop
 
Top