Form button opens blank form

A

Annemarie

I have a button on a form that when you click on it, opens a data entry form.
When I click on the button, it opens the form, but it's blank. There are no
fields displayed. Here is the SQL for the button:
-------------------------------
Private Sub AddContact_Click()
On Error GoTo Err_AddContact_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "add_contact"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_AddContact_Click:
Exit Sub

Err_AddContact_Click:
MsgBox Err.Description
Resume Exit_AddContact_Click

End Sub
 
G

Gina Whipp

Annemarie,

It might be the underlining query to the from 'add_contact. You might want
to take a look at that query and see if it allows you enter records.
 
J

John W. Vinson

I have a button on a form that when you click on it, opens a data entry form.
When I click on the button, it opens the form, but it's blank.

This will happen if two conditions are true: the Form's recordsource query
doesn't return any records (so you don't see any existing data), and it isn't
updateable (so you don't see the new record either).

Try opening the form's Recordsource query as a datasheet. Does it show just
the fieldname headers? If so my guess is correct.

Fix the error in the query and try again. If you need help doing so please
post the SQL view of the query, and a description of the table or tables
involved.
 
A

Annemarie

There is no filter on either the lookup_form or the add_contact form. The
Allow Additions and Allow Edits on the problem form (add_contact) are all set
to yes. The Allow Additions on the main form (lookup_form) is set to yes, but
the Allow Edits on that form is set to no. I set everything to yes on both
forms and still had the same problem.
 
J

John W. Vinson

There is no filter on either the lookup_form or the add_contact form. The
Allow Additions and Allow Edits on the problem form (add_contact) are all set
to yes. The Allow Additions on the main form (lookup_form) is set to yes, but
the Allow Edits on that form is set to no. I set everything to yes on both
forms and still had the same problem.

I'm baffled, Annemarie. All I can suggest is that you create a new form from
scratch and see if it has the same problem. I'd suggest copying and pasting
the controls but that might just copy the problem.
 

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