|
-
Apr 5th, 2007, 07:51 AM
#1
Thread Starter
Hyperactive Member
PK in Access table?
Hi,
I´m trying to move up from Access to VB. In an access db I have a table with an autonumber(PK) and a text field.
I´ve managed the database connection and I use a datagrid for the table. Now when I add a record by writing something in the text field, I want the autonumber to increment like in access.
How do I do this? I´ve tried searching the forum, but with no luck. I´m guessing this is so easy that there isn´t even a thread for it.
I´m using VB 2005 express.
Thanks!
Fuga.
-
Apr 5th, 2007, 09:27 AM
#2
Hyperactive Member
Re: PK in Access table?
Hi Fuga;
Now when I add a record by writing something in the text field,
I want the autonumber to increment like in access.
The autonumber field will automatically increment as soon as you
- Select it with the mouse, tab into it etc
- Enter data in your text field
- Will continue to increment if you select and deselect it several times.
I'm not sure what your reference to moving up from Access to VB refers to. Access is a database and VB is a programming language. The two are not the same.
-
Apr 5th, 2007, 10:23 AM
#3
Thread Starter
Hyperactive Member
Re: PK in Access table?
Thanks for your answer.
The autonumber field will automatically increment as soon as you
- Select it with the mouse, tab into it etc
- Enter data in your text field
- Will continue to increment if you select and deselect it several times.
The thing is, it doesn´t. I thought it would but it doesn´t. If I pout something in the text field, the autonumber doesn´t follow, so the post cannot be saved.
My databases tend to be more and more like programs, so I thought I might as well turn them into "real" programs. Otherwise I´m quite happy with Access.
Fuga.
-
Apr 5th, 2007, 11:12 AM
#4
Hyperactive Member
Re: PK in Access table?
Hi Fuga;
I created a simple two column table with an autonumber primary key to test it before I posted and it worked with no problems.
Are you sure that your PK field is in fact an autonumber field?
-
Apr 5th, 2007, 11:28 AM
#5
Thread Starter
Hyperactive Member
Re: PK in Access table?
I made a new dataconnection, and now it works!
I must have made a mistake somewhere. The field was an autonumber however.
Thanks!
Fuga.
Last edited by Fuga; Apr 5th, 2007 at 11:45 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|