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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form based on queries

Status
Not open for further replies.

Krash878

Programmer
May 8, 2001
172
US
I have multiple forms based on queries and some times they open blank. Is there a way that if they are going to be blank to not open them at all?
 
Usually even there's no data returned, the form will still be opened with no data. Not go blank. If it's going blank, it means something wrong with the query or the unjoined relationship. One way, you can set the query property to Dynaset Inconsistent to return no data instead of blank.

However, if you just think of canceling the form opening when there's no data, I'll say on Form_Load, create recordset, if isnull(rs.recordcount) then close form. This can be done through code or macro (cancelEvent).

Hope you work it out.
 
I have a similar problem. I have forms with subforms based on pass-through queries. Sometimes the forms will open with an empty set.

I would like to show the form with blank data; however, the main form opens blank, and the subform brings up an error (err# 2455). I link the recordsource to the form through code, not through design view.

I tried setting the form and subform as Dynaset Inconsistent, as described above, but this did not help.

Any idea how to open a form based on empty data showing empty fields instead of a blank form?

Thanks a lot,
Matt
 

The other way to do that, you need to set the form/subfrom AllowAddition property to Yes. Then it will display blank fields, not dimmed/blank form.



 
No, AllowAddition property was already set to Yes. Still blank form and an error for the subform (apparently you can't link a subform to empty data). Any other ideas?

Thanks,
Matt
 
Sorry, last time I got the same problem, it was fixed that way. However, if you'd like, you can send me a sample.zip file for me to figure it out.

tin.tin.thio@terabeam.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top