handling a No-Additions form that goes blank

P

Paul James

I have a form whose Allow Additions property is set to No. When the form
opens and there are no records in the form's Recordset, the entire form goes
blank. That is, not only do the bound controls disappear from the form, but
other objects such as labels and command buttons also disappear, so the user
can see nothing but a blank form.

I'm thinking that if I could put something in the form's Open Event that
could tell there are no records, then I could also have the Open Event close
the form and open another form that gave the user an explanation, or take
other suitable action. Would this be a good way to handle the situation?
If so, how can you test to see if there are no records in the form's
recordset in VBA?

Otherwise, is there a better way to do this?

Thanks in advance,

Paul
 
M

Max Smart

You could modify this...

If IsNull(DLookup("[PaymentID]", "[Payments]",
"[OrderID]="Forms![Pledges]![Pledges Subform].Form![OrderID])) Then
MsgBox "There is no data to view."
Else
DoCmd.OpenForm "Payments", , , "[Payments]![OrderID] =
Forms![Pledges]![Pledges Subform].Form![OrderID]"
End If

Max
 
D

david epsom dot com dot au

Only the detail section goes blank. Put the form header into the
form header section, and put the command buttons into the form footer
section.

(david)
 
P

Paul James

Another good suggestion.

Thanks, David.

Is it my imagination, or do we have a disproportionate number of Access
experts in Australia?

(Disproportionate to the population, that is).
 
D

david epsom dot com dot au

I am sure there are many good German/Italian/Spanish speaking Access
experts that we never hear from here. But I wonder about the UK.
Do they have relatively high Internet costs? In Aus, the UK has the
reputation of having very poor programming skills. I wonder if that
is true? Or is it only a very offensive racist/chauvinist myth?

Any Home County/London Access programmers welcome to respond!

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top