Need blank data entry screen

G

Guest

Sorry for posting this twice - I put it in the wrong area the 1st time.

My form is used to enter new contacts; but you can also use an unbound
control box to search for an existing contact. Currently, when I open the
form it opens up to the first record entered (I want a blank record). If I
search for an existing record, it brings that information up (as it should).
So, what I'd like to happen is for the form to open up to a blank data entry
screen and if I choose to add a new contact great, and when I search for an
existing contact it should still bring it up.. (I have tried setting the Data
Entry property to Yes, but then when I try to search for an existing record
it does not bring it up.) Any suggestions?
 
A

Allen Browne

Add this code to the Load event procedure of the form:

If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End if
 
G

Guest

DRMOB,

Try this.

Do not set DataEntry to True on the properties window. Leave it False.
Instead use something like the following to open the form when you wish to
add a record.

Dim stDocName As String

stDocName = "frmContacts"
DoCmd.OpenForm stDocName, , , , acFormAdd

The "acFormAdd" attribute will cause the form to open in DateEntry Mode and
you can use the form in the same manner that you would normally use it to add
a record.

If you wish to search for a record instead instead of entering a new record,
add the following line of code to the beginning of your search code.

Me.DataEntry = False

This will return the form to its normal mode and allow the search mechanism
to function as you intend.

If you wish to Add a record and then search for a record then you will need
to also add the following command somewhere in the process.

Me.Refresh

This will save the new record that you have just added.

Jack Cannon
 
G

Guest

Thanks that worked.

Allen Browne said:
Add this code to the Load event procedure of the form:

If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End if
 

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