Well i'm trying to create a form in VB6 to control my database that was created by access, i did everything and everything went perfect,until i notice that if you enter the same "ID" i get an erreur from access that there is multiple Ids with the same number,since i activated the primary key in access so it doesn't allow that,so what i'm trying to do is when the user move from the Id cell to other cell,visual basic scan the id cell first and check if there is no other id with the same number,if it is i need visual basic to prompt me with msgbox that say's there is multiple id with the same number. i hope that you understand what i'm trying to say i need a way to do it,just the way to follow.thanks
* image : http://i.stack.imgur.com/oqBpI.png

Recommended Answers

All 3 Replies

Please show your codes first. Here are many exparts, who can give you correct way to solve your problems.

If i understand you, what you need is for the program to give the next open id number, you put auto increment in the id details in the database, open a new record, and ask the database what was the id it created. This is the id you use for the updating of the rest of the data. The id textbox should not be enabled.

you can write a code in the lostfocus of that textbox to search that number which you entered in the database if found it give you message box telling you that the number or ID already exist and the textbox.setfocus to take you back to the same box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.