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
|
Coyote Level: Guest
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...