PopUp Form is blank white

G

Guest

I have a PopUp Form that works fine - - except if the query which is its
record source returns (has returned) no record. In this case the form opens
to a blank white - not even labels show.

Have never seen this before and would welcome advice that explains why even
labels do not appear.

Related to this; in the remote situation where there is no record I probably
need a default message in this popup form and was initially thinking a
non-visible label made visible if a field was null . But in seeing the
entire form blank when there is no record (which I suppose is a state
different than a null) I guess I need another approach. Would welcome input.
 
R

ruralguy via AccessMonster.com

Set allow additions to YES and see what happens. You can check for RecordSet.
RecordCount = 0 in the Open or Load events and take some other action if you
like.
 
M

missinglinq via AccessMonster.com

Ruralguy's suggestion is right on the money. The reason for this behavior is
that somewhere AllowAdditions is set to No and, as you've figured out, the
RecordSource for the form returns no records. This is the normal behavior for
these circumstances. Apparently, you've just never run into it before!

If you normally need to have Allow Additions set to No, but want to see the
controls even when there are no records, you can use something like the
following. I use it when I need Allow Additions set to No, but need the
controls to show up the first time an end user opens the form so that they
can load the database.

Private Sub Form_Open(Cancel As Integer)
If RecordsetClone.RecordCount = 0 Then
Me.AllowAdditions = True
End If
End Sub
 
G

Guest

Hi both - and thanks for replies;

In fact Allow Additions was set to 'yes'. So no fix.

For the sake of full disclosure; this little popup form has a subform. The
subform was NOT set to Allow Additions - so I changed that to 'yes' - - - but
still no fix.

On the otherhand; it is definitely the MasterForm that is the issue.
Because even when the subform has a record - if the MasterForm does not have
any record source the entire form is blank white.....so it is definitely the
MasterForm's behavior....

Thinking out loud am wondering if the definition as a PopUp is part of the
issue....I rarely use this feature and thus maybe wonder about it.......
 
G

Guest

nah - ignore that last thought ....changed it from pop up to regular form -
and is still totally blank white if there is no record being fed from the
underlying record source query.....nothing is loading.....strange..... b.t.w.
Access2003

wonder if I can work around by forcing always at least some record
somehow....or maybe toggling to close the form and open another if no
record....so the blank form is not seen......
 
R

ruralguy via AccessMonster.com

Turn Data Entry on just to see if we're nuts. It should have worked.
nah - ignore that last thought ....changed it from pop up to regular form -
and is still totally blank white if there is no record being fed from the
underlying record source query.....nothing is loading.....strange..... b.t.w.
Access2003

wonder if I can work around by forcing always at least some record
somehow....or maybe toggling to close the form and open another if no
record....so the blank form is not seen......
Ruralguy's suggestion is right on the money. The reason for this behavior is
that somewhere AllowAdditions is set to No and, as you've figured out, the
[quoted text clipped - 12 lines]
End If
End Sub
 
G

Guest

alas - turned Data Entry to 'yes' - - and still a blank form.

However I have fixed via a work around very nicely and so for anyone who
might read this issue in the future; because my popup is blank when its
query source has no record I toggle to another 'default popup'. To implement
this I add the suggested code to the 'normal popup' OnOpen event:

Dim stDoc As String
stDoc = "DefaultPopUpFormName"
If RecordsetClone.RecordCount = 0 Then
DoCmd.OpenForm acForm, stDoc
End If

This opens the 'default PopUp' that has a message on it that is meaningful
to the user - I didn't use a message box because this default PopUp also has
the same subform that the 'regular popup' has... works fine.

Also fyi - I needed to close the 'regular popup'; (which is blank and still
also opening at the same time) - - I put in the OnOpen event of the the
'default popup' the command to close the regular popup - its a good place for
it since the 'default popup' will only be opening when the 'regular popup'
should get closed:

Dim DocName As String
DocName = "RegularPopUpFormName"
DoCmd.Close acForm, DocName

ok - a little convoluted - I will admit......no awards for elegance....

I do appreciate the help though it pointed me in the right direction with
the If RecordsetClone.RecordCount = 0 idea....

thnks

--
NTC


ruralguy via AccessMonster.com said:
Turn Data Entry on just to see if we're nuts. It should have worked.
nah - ignore that last thought ....changed it from pop up to regular form -
and is still totally blank white if there is no record being fed from the
underlying record source query.....nothing is loading.....strange..... b.t.w.
Access2003

wonder if I can work around by forcing always at least some record
somehow....or maybe toggling to close the form and open another if no
record....so the blank form is not seen......
Ruralguy's suggestion is right on the money. The reason for this behavior is
that somewhere AllowAdditions is set to No and, as you've figured out, the
[quoted text clipped - 12 lines]
End If
End Sub

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

Glad to hear you got something working. That is a strange one.
alas - turned Data Entry to 'yes' - - and still a blank form.

However I have fixed via a work around very nicely and so for anyone who
might read this issue in the future; because my popup is blank when its
query source has no record I toggle to another 'default popup'. To implement
this I add the suggested code to the 'normal popup' OnOpen event:

Dim stDoc As String
stDoc = "DefaultPopUpFormName"
If RecordsetClone.RecordCount = 0 Then
DoCmd.OpenForm acForm, stDoc
End If

This opens the 'default PopUp' that has a message on it that is meaningful
to the user - I didn't use a message box because this default PopUp also has
the same subform that the 'regular popup' has... works fine.

Also fyi - I needed to close the 'regular popup'; (which is blank and still
also opening at the same time) - - I put in the OnOpen event of the the
'default popup' the command to close the regular popup - its a good place for
it since the 'default popup' will only be opening when the 'regular popup'
should get closed:

Dim DocName As String
DocName = "RegularPopUpFormName"
DoCmd.Close acForm, DocName

ok - a little convoluted - I will admit......no awards for elegance....

I do appreciate the help though it pointed me in the right direction with
the If RecordsetClone.RecordCount = 0 idea....

thnks
Turn Data Entry on just to see if we're nuts. It should have worked.
[quoted text clipped - 12 lines]
 
K

Ken Snell \(MVP\)

Is the query an updatable query? If it's not, you will not get any "blank"
record in the popup form, regardless of setting the AllowAdditions property
to Yes.

--

Ken Snell
<MS ACCESS MVP>


NetworkTrade said:
alas - turned Data Entry to 'yes' - - and still a blank form.

However I have fixed via a work around very nicely and so for anyone who
might read this issue in the future; because my popup is blank when its
query source has no record I toggle to another 'default popup'. To
implement
this I add the suggested code to the 'normal popup' OnOpen event:

Dim stDoc As String
stDoc = "DefaultPopUpFormName"
If RecordsetClone.RecordCount = 0 Then
DoCmd.OpenForm acForm, stDoc
End If

This opens the 'default PopUp' that has a message on it that is
meaningful
to the user - I didn't use a message box because this default PopUp also
has
the same subform that the 'regular popup' has... works fine.

Also fyi - I needed to close the 'regular popup'; (which is blank and
still
also opening at the same time) - - I put in the OnOpen event of the the
'default popup' the command to close the regular popup - its a good place
for
it since the 'default popup' will only be opening when the 'regular popup'
should get closed:

Dim DocName As String
DocName = "RegularPopUpFormName"
DoCmd.Close acForm, DocName

ok - a little convoluted - I will admit......no awards for elegance....

I do appreciate the help though it pointed me in the right direction with
the If RecordsetClone.RecordCount = 0 idea....

thnks

--
NTC


ruralguy via AccessMonster.com said:
Turn Data Entry on just to see if we're nuts. It should have worked.
nah - ignore that last thought ....changed it from pop up to regular
form -
and is still totally blank white if there is no record being fed from
the
underlying record source query.....nothing is loading.....strange.....
b.t.w.
Access2003

wonder if I can work around by forcing always at least some record
somehow....or maybe toggling to close the form and open another if no
record....so the blank form is not seen......

Ruralguy's suggestion is right on the money. The reason for this
behavior is
that somewhere AllowAdditions is set to No and, as you've figured out,
the
[quoted text clipped - 12 lines]
End If
End Sub

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

Thanks for jumping in Ken. We overlooked that point for sure.
Is the query an updatable query? If it's not, you will not get any "blank"
record in the popup form, regardless of setting the AllowAdditions property
to Yes.
alas - turned Data Entry to 'yes' - - and still a blank form.
[quoted text clipped - 56 lines]
 
G

Guest

ummm...hmmm...is the query "updateable" ??; not sure the meaning of this term
- sorry.

The query does not allow one to add a new record. (i.e. when it returns
records there is no ability to make a new record using the query itself.)

The query is parameter-ed from values in txtBoxes found in an active Form
(that precedes the popup form action).

Just to review: These values are put in by user and then when they move down
to a blank txtBox - the popup happens giving them some useful data that helps
them decide what to put into this next txtBox.

Works great - if I do say so myself - - - as long as there is a record
generated by that popup form's query....if not all you get is a blank form.
No record is rare but not impossible, so I need a default message essentially
saying that there is no data but I also need the info in the subform of the
popup to show....but hey am repeating myself....

if that helps and is relevant.

I think the core issue is;
*when the record source of a form is a query
*and that query is not producing any record
*the form is not loading

I can accept that perhaps that is "just the way it is". It isn't
unreasonable behavior actually. But I just had never seen it before and so
am always trying to further my understanding. I sort of expected the form to
load but the bound controls to have an error type display.... So I expected
to see the labels and the subform. Did not expect that the form would not
load.

Definitely welcome additional input.

Regards,
NTC
--
NTC


Ken Snell (MVP) said:
Is the query an updatable query? If it's not, you will not get any "blank"
record in the popup form, regardless of setting the AllowAdditions property
to Yes.

--

Ken Snell
<MS ACCESS MVP>


NetworkTrade said:
alas - turned Data Entry to 'yes' - - and still a blank form.

However I have fixed via a work around very nicely and so for anyone who
might read this issue in the future; because my popup is blank when its
query source has no record I toggle to another 'default popup'. To
implement
this I add the suggested code to the 'normal popup' OnOpen event:

Dim stDoc As String
stDoc = "DefaultPopUpFormName"
If RecordsetClone.RecordCount = 0 Then
DoCmd.OpenForm acForm, stDoc
End If

This opens the 'default PopUp' that has a message on it that is
meaningful
to the user - I didn't use a message box because this default PopUp also
has
the same subform that the 'regular popup' has... works fine.

Also fyi - I needed to close the 'regular popup'; (which is blank and
still
also opening at the same time) - - I put in the OnOpen event of the the
'default popup' the command to close the regular popup - its a good place
for
it since the 'default popup' will only be opening when the 'regular popup'
should get closed:

Dim DocName As String
DocName = "RegularPopUpFormName"
DoCmd.Close acForm, DocName

ok - a little convoluted - I will admit......no awards for elegance....

I do appreciate the help though it pointed me in the right direction with
the If RecordsetClone.RecordCount = 0 idea....

thnks

--
NTC


ruralguy via AccessMonster.com said:
Turn Data Entry on just to see if we're nuts. It should have worked.

NetworkTrade wrote:
nah - ignore that last thought ....changed it from pop up to regular
form -
and is still totally blank white if there is no record being fed from
the
underlying record source query.....nothing is loading.....strange.....
b.t.w.
Access2003

wonder if I can work around by forcing always at least some record
somehow....or maybe toggling to close the form and open another if no
record....so the blank form is not seen......

Ruralguy's suggestion is right on the money. The reason for this
behavior is
that somewhere AllowAdditions is set to No and, as you've figured out,
the
[quoted text clipped - 12 lines]
End If
End Sub

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
K

Ken Snell \(MVP\)

NetworkTrade said:
ummm...hmmm...is the query "updateable" ??; not sure the meaning of this
term
- sorry.

The query does not allow one to add a new record. (i.e. when it returns
records there is no ability to make a new record using the query itself.)


The above observation confirms that the query is not updatable. Therefore,
any attempt to build a data-entry form using the query will result in a
blank form if you set Data Entry property to Yes or if there are no records
returned by the query.

See these articles for information about what can make a query nonupdatable
(watch for line-wrapping):

When can I update data from a query?
http://msdn.microsoft.com/library/d...l/acconDeterminingWhenCanUpdateDataQueryS.asp

Harnessing the Power of Updatable Queries
http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_harness.asp

ACC2000: Cannot Edit or Update Record on a Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;209571&Product=acc

ACC2000: Status Bar Displays "Recordset Not Updateable" Message When You Try
to Update a Linked Table
http://support.microsoft.com/default.aspx?scid=kb;en-us;304179&Product=acc

INFO: Troubleshooting Errors That May Occur When You Update Data in Queries
and in Forms
http://support.microsoft.com/default.aspx?scid=kb;en-us;328828&Product=acc

ACC: Update Query Based on Totals Query Fails
http://support.microsoft.com/default.aspx?scid=kb;en-us;116142&Product=acc
 
K

Ken Snell \(MVP\)

NetworkTrade said:
I need a default message essentially
saying that there is no data but I also need the info in the subform of
the
popup to show....but hey am repeating myself....

Because your popup form's RecordSource query uses a query that reads a
parameter from the form, the easiest way of doing this is to use the popup
form's Open event to test if there are any records to be displayed; if not,
cancel the form's opening:

Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then Cancel = True
End Sub


Then add 4 lines of code to your code that opens the popup form to trap the
error that occurs if the popup form is cancelled and to tell the user there
are no records to display:

DoCmd.OpenForm "NameOfPopupForm"
' Next four lines are new
If Err.Number = 2501 Then ' error that occurs if popup form is cancelled
Err.Clear
MsgBox "No records to display."
End If
 
J

John W. Vinson

ummm...hmmm...is the query "updateable" ??; not sure the meaning of this term
- sorry.

The query does not allow one to add a new record. (i.e. when it returns
records there is no ability to make a new record using the query itself.)

Then it's not updateable. That's what it means - the Query cannot be used to
edit or add records.
The query is parameter-ed from values in txtBoxes found in an active Form
(that precedes the popup form action).

Just to review: These values are put in by user and then when they move down
to a blank txtBox - the popup happens giving them some useful data that helps
them decide what to put into this next txtBox.

Works great - if I do say so myself - - - as long as there is a record
generated by that popup form's query....if not all you get is a blank form.
No record is rare but not impossible, so I need a default message essentially
saying that there is no data but I also need the info in the subform of the
popup to show....but hey am repeating myself....

You can use the popup form's Open event to cancel opening the form if there is
no data:

Private Sub Form_Open(Cancel as Integer)
If Me.RecordsetClone.Recordcount = 0 Then
MsgBox "No data to display!", vbOKOnly
Cancel = True
End If
End Sub

John W. Vinson [MVP]
 
G

Guest

appreciate all input.

I now have a better understanding of 'updateable' query/form interaction....
 

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