PDA

Click to See Complete Forum and Search --> : VB help


Rene Schmitt
Jun 24th, 1999, 01:20 PM
Dear Sir,

I started learning VB only twelve months ago and although I find it fascinating, I must agree that I am still very green to visual programming. Everything that I know now has been self taught, using books and tips from the internet. I have created a few (very simple) applications which I am very proud of.

I am now working on a project where I need a little help from experienced VB programmers like you.

In order to keep in touch with relatives and friends, I have created a simple database in MS Access where I store, in a table their Surnames, First Names, Addresses, Phone Numbers etc
I have also created a query and form from that table, where I inserted in the “Surname” column/criteria the following message: [Please Enter Surname]. When I run the form, an input box appears, and prompts me to enter a surname. After entering a surname eg Smith, (as you guessed it) the first record with the name Smith appears on the form and gives me all relevant details about the record. This works fine.

I have created a new project in VB based on the above mentioned database and when I run the application, the form that is loaded always shows the first record on the database. As it is not possible to include queries from Access where a criteria exists, or include a form created in Access in a VB project, I would like to know, How to write a code that will prompt me (through an input box) to enter a “Surname”, in order to retrieve the first record in the DB with the Surname entered in the Input Box.

Your help will be greatly appreciated


Regards


Rene Schmitt

bashfirst
Jun 25th, 1999, 04:38 PM
You could use an InputBox to provide the prompt, but why make your user remember the Surname they want to see? Why not provide a combo box on the form with all the Surnames. The user can scroll thru the list, click on the desired Surname, and you can use the combobox_click event to do your lookup.