ms+access+courses - primary key access

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » ms+access+courses - Primary Key in Access

ms+access+courses - Primary Key in Access

resolvedResolved · Urgent Priority · Version Standard

Reza has attended:
Excel Advanced course

Primary Key in Access

I have tried on many occasions to define my own start number for primary key and let Access to auto-increment it. Still it does not work. Can you please instruct me step-by-step how do I define it.

Also recently I have error msg "OpenReport Action Cancelled " when I attempt to click on my buttons. Any solutions?

Regards
Rez

RE: Primary Key in Access

Hi Rez

Thanks for your question - sorry about the delay in replying.

I'm not sure why the error message is coming up, but with defining your own start number try the following:

Before you begin, if your original table contains property settings that prevent Null values in fields, you must temporarily change those properties. These settings include:
The Required field property set to Yes
The Indexed field property set to Yes (No Duplicates)
A field and/or record ValidationRule property that prevents Null values in fields

Then:
1. Create a temporary table with just one field: a Number field. Set its FieldSize property to Long Integer and give it the same name as the AutoNumber field in the table whose value you want to change.

2. In Datasheet view, enter a value in the Number field of the temporary table that is one (1) less than the starting value you want for the AutoNumber field. For example, if you want the AutoNumber field to start at 100, enter 99 in the Number field.

3. Create and run an append query to append the temporary table to the table whose AutoNumber value you want to change.

4. Delete the temporary table.

5. Delete the record added by the append query.

6. If you had to disable property settings in step 1, return them to their original settings.
When you enter a record in the remaining table, Microsoft Access uses an AutoNumber field value one (1) greater than the value you entered in the temporary table.

I hope this helps.
Amanda

RE: Primary Key in Access

Hi Amanda,

Thank you for your instructions. I will try it and will get back to you if I face any issue.

Regards
Rez

Set up user account and password for users

Can I get some step-by-step instructions to set up group with their initials and their own password to access to database.

However I have already tried to open the acount for users but for some reasons it doesnt work.
Thank you


 

Access tip:

Modal forms

If you have created a form / switchboard and dont want people to get away from using the switchboard, you can change the form properites for Modal to On.

View all Access hints and tips


Server loaded in 0.09 secs.