views:

561

answers:

3

I'm building a form in access that has a several sub-forms in a tab control The sub-forms are working fine, but when I set the parent form's Record Source property and bind a few Text Boxes to the data, I find that a null recordset has been returned.

I've tried this with several different queries (each of which works in a separate query designer) to no avail. I've also tried binding the form to a Table directly and a null recordset is still returned.

I've checked the filters and they are turned off.

A: 

Have you tried executing a Requery on your parent form:

Me.RecordSource = "someQuery"
Me.Requery

?

CodeSlave
I couldn't remember so I tried and it didn't work.
Rister
+1  A: 

If the Text Boxes that are bound to data are Locked and Disabled then the query will return a null dataset by default.

The form's 'Data Entry' property also needs to be set to false. Setting it to true will make the form for data entry only. This prevents any data that might be returned by the background dataset from appearing when the form loads.

Rister
CodeSlave
I'm just reporting what worked (I'm only guessing as to why).I didn't include a code example because this is all done in the Access 2007 form designer GUI. No code to be found. The query (if I was actually using a query) would read something like this: SELECT * FROM Table;Not a whole lot there.And when I bind a field to a locked and disabled Text Box I lose the whole recordset, not just a few fields.
Rister
A: 

Can you unlock and/or enable the fields before setting the data source?

Jeff O
I could and then lock them in the On Load method, but the data mainly for reference anyway. I don't do any additions from the parent form.
Rister