Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

PopUp Form is blank white

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NetworkTrade - 10 May 2007 00:24 GMT
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.
Signature

NTC

ruralguy - 10 May 2007 00:40 GMT
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.

>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
[quoted text clipped - 8 lines]
>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.

Signature

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

missinglinq - 10 May 2007 01:35 GMT
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
NetworkTrade - 10 May 2007 02:38 GMT
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.......

Signature

NTC

> 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
NetworkTrade - 10 May 2007 02:47 GMT
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......

Signature

NTC

> 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
ruralguy - 10 May 2007 03:10 GMT
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
[quoted text clipped - 10 lines]
>>    End If
>> End Sub

Signature

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

NetworkTrade - 10 May 2007 04:00 GMT
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

Signature

NTC

> Turn Data Entry on just to see if we're nuts.  It should have worked.
>
[quoted text clipped - 12 lines]
> >>    End If
> >> End Sub
ruralguy - 10 May 2007 04:17 GMT
Glad to hear you got something working.  That is a strange one.

>alas - turned Data Entry to 'yes' - - and still a blank form.
>
[quoted text clipped - 35 lines]
>> >>    End If
>> >> End Sub

Signature

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

Ken Snell (MVP) - 10 May 2007 05:10 GMT
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.

Signature

       Ken Snell
<MS ACCESS MVP>

> alas - turned Data Entry to 'yes' - - and still a blank form.
>
[quoted text clipped - 56 lines]
>> >>    End If
>> >> End Sub
ruralguy - 10 May 2007 12:40 GMT
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
[quoted text clipped - 5 lines]
>>> >>    End If
>>> >> End Sub

Signature

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

NetworkTrade - 10 May 2007 15:27 GMT
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
Signature

NTC

> 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
[quoted text clipped - 60 lines]
> >> >>    End If
> >> >> End Sub
Ken Snell (MVP) - 10 May 2007 18:20 GMT
> 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/default.asp?url=/library/en-us/off2000/html/ac
conDeterminingWhenCanUpdateDataQueryS.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

Signature

       Ken Snell
<MS ACCESS MVP>

Ken Snell (MVP) - 10 May 2007 18:28 GMT
> 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

Signature

       Ken Snell
<MS ACCESS MVP>

John W. Vinson - 10 May 2007 20:45 GMT
>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).  
[quoted text clipped - 8 lines]
>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]
NetworkTrade - 11 May 2007 00:31 GMT
appreciate all input.

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

Signature

NTC

> >ummm...hmmm...is the query "updateable" ??; not sure the meaning of this term
> >- sorry.  
[quoted text clipped - 29 lines]
>
>              John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.