Selecting Records from a List Box

JoseSharp

Registered User.
Local time
Today, 02:33
Joined
Oct 23, 2006
Messages
15
Hi all, any help welcome with this one.

I have some code that currently works with my MS Access D'base. The user highlights data within a list box and the cells above are populated with the users selection. Now I have moved the D'base to SQL and the code no longer works. I was wondering if any one else has some clever code that update cells when selecting from a list box. The code I used is as follows (ID is the fields with the unique identifier and lstRecords is the list box):

ynListSel = True
Dim rs As Object

With frm
Set rs = .Recordset.Clone
rs.FindFirst "ID = " & !lstRecords
.Bookmark = rs.Bookmark
!cmdNewRecord.Enabled = True
End With

Set frm = Forms!frmMain
varInvoiceRef = frm!lstRecords
 
I do this quite often but don't use a recordset (As such) as the source of the list box. I use a SQL statement with the first column, which is the key to the record, hidden.

The user clicks on the record in the list and the OnClick event runs code to create a recordset based on only that one record and populate the text boxes on the form.
 

Users who are viewing this thread

Back
Top Bottom