Form Opens Blank

G

Guest

The code below is on the open event of my form. For some reson the form opens
blank. If I go to form design and then go back to form view, it works as
planned. But when I close the form and then open it back up again it opens
blank again. On the form I have a pair of listboxes. If I comment out the
Me.AllowAdditions=False, then the form opens correctly, but then my listboxes
are still available to be clicked on which triggers events I have coded in
the listboxes (dblclk).

Please tell me why the Me.AllowAdditions = False cause this to happen? Is
there something else I can do?

Thanks, Rob


Private Sub Form_Open(Cancel As Integer)
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
End Sub
 
R

Rick Brandt

RobUCSD said:
The code below is on the open event of my form. For some reson the
form opens blank. If I go to form design and then go back to form
view, it works as planned. But when I close the form and then open it
back up again it opens blank again. On the form I have a pair of
listboxes. If I comment out the Me.AllowAdditions=False, then the
form opens correctly, but then my listboxes are still available to be
clicked on which triggers events I have coded in the listboxes
(dblclk).

Please tell me why the Me.AllowAdditions = False cause this to
happen? Is there something else I can do?

Thanks, Rob


Private Sub Form_Open(Cancel As Integer)
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
End Sub

The detail section of a bound form is completely blank when there are no
existing records and no ability to add new ones. Once you have some data in the
tables that the form is using then the blank appearance should go away.
 
G

Guest

Thanks for your reply. I do have existing records in the underlying table and
it still opens blank. What I'm trying to accomplish is getting my form to
open and have the listboxes inactive, i.e., if they are clicked on I don't
want my event code to run unless the user clicks the edit button first. The
Me.Form.Allowedits = False does not acomplish this on this particular form
for some reason.

Any help would be much appreciated.
Rober
 
R

Rick Brandt

RobUCSD said:
Thanks for your reply. I do have existing records in the underlying
table and it still opens blank. What I'm trying to accomplish is
getting my form to open and have the listboxes inactive, i.e., if
they are clicked on I don't want my event code to run unless the user
clicks the edit button first. The Me.Form.Allowedits = False does not
acomplish this on this particular form for some reason.

Any help would be much appreciated.
Rober

Open the form in design view and click on the build button next to the
RecordSource property. That will open the query designer for the query or SQL
statement that the form is using. Change to datasheet view of that query. My
guess is that it will not contain any records. If the query uses more than one
table the join structure is probably causing it to return zero rows.

Just to clarify, while you don't get a completely blank form when AllowAdditions
is set to True you still don't get any records right? Just the new record
position filled with empty controls?
 
G

Guest

I tried running the query that the form is based on and it returns records.
When the Allowedits = True I do get all the existing records. Very Strange.
Robert
 
R

Rick Brandt

RobUCSD said:
I tried running the query that the form is based on and it returns
records. When the Allowedits = True I do get all the existing
records. Very Strange. Robert

Yeah that really doesn't make any sense. As an alternative you could lock and
unlock the controls instead of using AllowEdits.
 
G

Guest

Thank you. You have no idea how long I've been messing with this problem. The
locking and un-locking works. Thanks again, Robert
 

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

Similar Threads


Top