Creating a form for adding data

thepooh

Registered User.
Local time
Tomorrow, 03:55
Joined
Jun 2, 2003
Messages
11
I've created a form in Access for user to add in data. I've set the Property of DataEntry to yes. But when I open the form, the fields are pre-filled with the data of the first record. How can I make the fields to be blank?
 
Have you got some default values set for your fields? If so, they will appear in the new record. If you want them to be blank, you'll have to remove the default settings or write code on the ON Open event for the form to make them empty strings
 
Two ways:

1) When you open the form with code from the calling from:

Code:
DoCmd.OpenForm "frmYourForm", acNormal, , , acFormAdd


2) In the Form_Load event of your form

Code:
DoCmd.GoToRecord, , acNewRec
 
I've checked the default value. The default value is not set. I've also tried adding the acFormAdd but the result is still the same. Before this, the form is working fine until I changed the table structure. The table is actually linked from SQL Server. If possible, I prefer not to do any coding in the form_load event to set all values to "".
 
Or you could use either of the one lines I've given you. ;)
 
I've tried this adding this:

DoCmd.OpenForm "frmYourForm", acNormal, , , acFormAdd

& I can't use this DoCmd.GoToRecord, , acNewRec in form_load because my data is displayed as columnar, not tabular. That's why can't go to add new record.

I really don't have a clue of what's the problem.
 
1) what is the name of your form? Have you put this in place of "frmYourForm"?

2)When the form is open, does the navigation bar have an enabled "new record" button ? (shows an asterisk)
 
1) Yes, I did change it to my own form. i.e:

DoCmd.OpenForm "frmEmployeeAdd", acNormal, , , acFormAdd

2) I've checked the form, the navigation bar shows 1 (means first record) instead of the *. So, how do I revert it back to *?
 
the navigation bar should show from left:

button- go to first record
button-go to previous record
Number of Current Record
button-go to next record
button-goto Last record
button-go to new record

is that last button enabled?
 
open the form in Design view and inspect the Data Properties.

Are Additions allowed?
Is the form set for Data Entry?
 
Properties for the form:
Record Source....Tbl_Employee
Allow Filters........Yes
Allow Edits..........Yes
Allow Deletions...Yes
Allow Additions...Yes
Data Entry..........Yes
Recordset Type...Dynaset
 

Users who are viewing this thread

Back
Top Bottom