Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect Subform with No Records

Status
Not open for further replies.

fredzeppelin

Technical User
Mar 17, 2005
26
0
0
US
Situation: Form with subform, linked parent/multiple child with referential integrity enforced.

Processing with pretty deep code. On occasions, the subform has no retrieved records(rare, but expected in one specific situation). Subsequent assigning data to field of non-retrieved record fails (of course, it doesn't exist!)

What's the best/any way to programmatically detect that subform has retrieved no records?
Code:
Main form is open, records are flying, data is processing...

    With [Forms]![frmpartdetailmultiform]![sfrPartRefurb].[Form] 
            'need to skip these if no linked record
            .ReturnDate = dtmEffDate  
            .ReturnLocation = stDestUnit

If linked subform sfrPartRefurb has no record(s), the assignment fails.

Haven't touched Access Basic/VBA in months,
I'm trying IsNull, IsEmpty, IsAnybodyBackThere?

What's the right way?

thanks, brad
 
Whoops, I tried the FAQs again with different key words, and found a suggestion.

Create a recordset from the subform linkfield criteria and count it.

I'll go try that.....

thanks again

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top