By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,659 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,659 IT Pros & Developers. It's quick & easy.

Access data entry problem

P: 24
I am using Access
I made a Database in which i define a field in table id as Auto increment field.
I im using switchboard manager to open the form in dataentry mode.
When i open form and just type some thing in other field not save it and close the form with out saving .
When i open again the form the Auto increment field is incremented.and there is no other data in other fields they are blanck.
Even when i Navigate through other fields and close it when i again open it the field is incremented .how to over come this problem.
Regards
<< ARALI >.
Jan 24 '08 #1
Share this Question
Share on Google+
6 Replies


mshmyob
Expert 100+
P: 904
Is your auto increment field bound to your table and your other fields unbound?


I am using Access
I made a Database in which i define a field in table id as Auto increment field.
I im using switchboard manager to open the form in dataentry mode.
When i open form and just type some thing in other field not save it and close the form with out saving .
When i open again the form the Auto increment field is incremented.and there is no other data in other fields they are blanck.
Even when i Navigate through other fields and close it when i again open it the field is incremented .how to over come this problem.
Regards
<< ARALI >.
Jan 24 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
When i open again the form the Auto increment field is incremented.and there is no other data in other fields they are blanck.
When you open a form in DataEntry mode the fields will always be blank! DataEntry mode only allows new records to be entered/viewed. The autoincremented field has a value because you've set this up to happen when a new record is created.
When i open form and just type some thing in other field not save it and close the form with out saving .
In Access, when you enter data in a record and then move to another record or close the form, the default behavior is to save the record, which is what is happening here. If you open your underlying table, you should see a record for each autoincrementing number you've created.

To prevent this from happening, you need to place code in the Form_BeforeUpdate event, asking the user if they want to save the record. If they respond Yes, you do nothing and the record is saved. If they respond No, you use Cancel = True which dumps the entered data.

Linq ;0)>
Jan 24 '08 #3

mshmyob
Expert 100+
P: 904
That is true Linq but according to his description he is opening the form for data entry and has a Autonumber field. As you say it will automatically generate a record and put a value in that field but then he also says that he enters data into other fields on his form and closes it 'without' saving and when he reopens it he has the new record with the autonumber filled in but no other data.

It sounds to me like his text boxes on his form are not bound to the table and that is why no data appears in the record other than the auto number field.

You think that might be what is happening? I am still waiting for his reply.

When you open a form in DataEntry mode the fields will always be blank! DataEntry mode only allows new records to be entered/viewed. The autoincremented field has a value because you've set this up to happen when a new record is created.

In Access, when you enter data in a record and then move to another record or close the form, the default behavior is to save the record, which is what is happening here. If you open your underlying table, you should see a record for each autoincrementing number you've created.

To prevent this from happening, you need to place code in the Form_BeforeUpdate event, asking the user if they want to save the record. If they respond Yes, you do nothing and the record is saved. If they respond No, you use Cancel = True which dumps the entered data.

Linq ;0)>
Jan 24 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
No, there is nothing in this post to suggest that his fields are unbound! If his post is accurate, that is not what is happening! He didn't say he was opening the form for data entry, he said

"I im using switchboard manager to open the form in dataentry mode."

As I explained before, when a form is opened in dataentry mode it opens to a new record. In dataentry mode you can only add new records, you cannot view existing records! The data he is entering is, I am sure, being saved to the underlying table; this is evidenced by the fact that the auto-incremented number keeps increasing.

He also made no mention of an Autonumber, he said auto incremented number. These are two entirely different things. An Autonumber is created by Access, and really should never be seen/used by the end user ; it should only be used by Access for internal housekeeping. An auto incremented number, on the other hand, is generated thru custom VBA code, and can be used for such things as generating ID numbers, account numbers, etc.

Linq ;0)>
Jan 24 '08 #5

mshmyob
Expert 100+
P: 904
Yes of course. Now I understand. He is constantly opening a new record, he is not reviewing his previous records.

Thanks for clearing that up for me.

No, there is nothing in this post to suggest that his fields are unbound! If his post is accurate, that is not what is happening! He didn't say he was opening the form for data entry, he said

"I im using switchboard manager to open the form in dataentry mode."

As I explained before, when a form is opened in dataentry mode it opens to a new record. In dataentry mode you can only add new records, you cannot view existing records! The data he is entering is, I am sure, being saved to the underlying table; this is evidenced by the fact that the auto-incremented number keeps increasing.

He also made no mention of an Autonumber, he said auto incremented number. These are two entirely different things. An Autonumber is created by Access, and really should never be seen/used by the end user ; it should only be used by Access for internal housekeeping. An auto incremented number, on the other hand, is generated thru custom VBA code, and can be used for such things as generating ID numbers, account numbers, etc.

Linq ;0)>
Jan 24 '08 #6

missinglinq
Expert 2.5K+
P: 3,532
It would appear that this is what's happening, from the information given in the original post. It would be unlikely (although, of course, not totally impossible) that the auto-incrementing field was bound but the other controls were unbound. Unbound controls generally have one of two purposes. They're either used to hold calculations, in which case you don't manually enter data in them, as the OP stated he does here, or they're used to enter criteria for something such as a search or for a query, in which case you don't expect to see the data in the control the next time you visit the record.


Linq ;0)>
Jan 24 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.