borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (VB6 => Access2000, Passing 2 Parameters?)Next Topic (How to display 3 colums in a List Box) New Topic New Poll Post Reply
AndreaVB Forum : Database : Getting
Poster Message
lwanzo
Level: Guest


icon Getting   Archived to Disk

I am working on Editing data from a Database, then be able to Update them. at this point, I have my data displayed on a ListBox; But I want to able to click one record on the ListBox, then get details of that record displayed on a different frm. What the select from a listBox and send ID of record..

01-08-2002 at 03:58 PM
| Quote Reply
Coyote
Level: Guest

icon Re: Getting   Archived to Disk

Well maybe I understand the question?
Guessing you have the ID listed in your list box from your database and they are unique/no duplicates.
You will first need to set up Public variable that can be accessed by everything in your project
For Example... Put this in a Module:

Public idx As String

Then in your first form (Form1) add this code for the click event on the listbox item:

Private Sub List1_Click()
    idx = List1.Text
    Form2.Show
End Sub

Then when you open the second form:  ie .. Private Sub Form_Load()
Open a new recordset with an SQL string something like:

strSQL = "SELECT * From Table1 where ID = idx"

You'll have to edit that to your table and field name - if it's not = ID.
This will give you the single record... if ID is a unique/no duplicates field.
Now fill your second form - from this new recordset.

Hope this helps... or comes close to answering your question...

>>>Coyote<<<

05-08-2002 at 03:20 AM
| Quote Reply
AndreaVB Forum : Database : Getting
Previous Topic (VB6 => Access2000, Passing 2 Parameters?)Next Topic (How to display 3 colums in a List Box) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder