Hello!

This is my first post to this forum, so I'm kind of losing my virginity right now
I am also new in VB. I hope that somebody would help me!

Ok, I have a problem with a database.

I want to make a program which has one input textbox, button "OK" and one Label.

then I have a MS access database file with 2 columns.
First column is for "First name" and the second one is for "Last name"

They contain names that don't repeat, which means every single one of them is unique.

I want this pogram to work like so: User types a first name into the textbox, hits "OK" button and then the program searches from the database column "First name" if the name exists. And if it exist then displays "Last name" (which is on the same row as "first name") as the label.

Is there anybody so kind and help me out with this? Some tutorials or code?

I don't want to prevent duplicates because there are none. Every row in each column are unique names and they don't repeat in any way, so there isn't problem with duplicates.

The program should work like this:
There is a textbox where user types a (first)name (for example John). Then user clicks a button "OK". Then the program scans database(created in MS Access) if this name exists there.
If the name "John" does exist then the program will display "Last name" as Label.

Is there any tutorial I could follow. Youtube perhaps or smth?

Thanks in advance.

Your best option (in my opinion) would be to use vbscript (as you want to use vbscript) in a .hta application.

The HTML part will give you an easy way to create a userinterface.
The vbscript seemed (pointing to your question) obligated..

If you google on "scripting guy" and vbscript and access I'm sure you will
get plenty of -ready to use- scripts..

(further info: .hta = a html-file with vbscript in it, but because of the "a" in the .hta extention, you are able to perform "system level tasks/actions" with your vbscript.)

These links should get you starting
http://msdn.microsoft.com/en-us/library/ms536496%28v=vs.85%29.aspx

More details about .hta:
http://en.wikipedia.org/wiki/HTML_Application

Is this VB6 or VB.NET ?
What version of Access ?
Are you using ADO ?
What version ?
Are you using Data Environment, Data Control, Binding
I am DEFINATELY not recommending any of those three, but I am just asking.

You say the names will be unique, but surely you could have John Smith and John Wayne ?
If that is the case then your statement (specification), will need correction/expansion -
"And if it exist then displays "Last name" (which is on the same row as "first name") as the label."

Edited 4 Years Ago by RobCr: spelling typo

This article has been dead for over six months. Start a new discussion instead.