|
-
Jul 8th, 2002, 02:44 AM
#1
Thread Starter
New Member
ADODB & List boxes
I am stuck on a slight programming problem:
I have a form that provides name number etc from a database using the activex db control (called adoDataControl). I can manage this bit OK. When I load the form I also call a procedure to populate a list box from another table usin a seccond ado activex control (Called adoExtraDetails). My naminc convention needs a little work I Know!
This works for the 1st time I open the form, but when I change the main record(Name number etc) the information in the list box changes.
I am querying the ID fro mthe main form each time I change record: See code below:
Public Function PopulateListBox()
On Error GoTo Err_PopList
With frmJobDetailsReview
.adoExtraDetails.ConnectionString = .adoDataControl.ConnectionString
.adoExtraDetails.RecordSource = "SELECT * FROM ContactDetails WHERE ID = " & .adoDataControl.Recordset!ID
Set .lstDateContact.DataSource = .adoExtraDetails
If .adoExtraDetails.Recordset.RecordCount > 0 Then
.adoExtraDetails.Recordset.MoveFirst
Do While Not .adoExtraDetails.Recordset.EOF
.lstDateContact.AddItem .adoExtraDetails.Recordset!ContactDate & "; " & .adoExtraDetails.Recordset!ContactTime
.adoExtraDetails.Recordset.MoveNext
Loop
.lstDateContact.Refresh
End If
End With
GoTo NoErr
Err_PopList:
MsgBox Err.Description
NoErr:
End Function
Any Help is greatly appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|