F
Filips Benoit
Dear All,
Access2000.adp connected to SQL-server 2000
MainForm unbound: seachform on companies meeting a complex combination of
criteria.
SubFrom and ListBox to display the searchresult ( 2 outputs to test what's
best).
Searchresult is stored in a creatable ADO-recordset (see code) and then
1. Converted to string (GetString) to be set as valuelist for a listbox.
2. bound to the subform.
The Listbox shows the resultdata correctly but is limited in length.
The subform shows the records but all fields are empty or displays #error
How should I bound the controls correctly to display the fieldvalues?
If I let them unbound the show up empty.
If I set them to the recordsets' fieldnames it show #error.
On my Notebook using MSDE there is no errormessage
On my Desktop i get error 7965 not a valid recordset property.
CAN'T FIND WHAT'S WRONG! Cursortype ??
Filip
CODE
'Store result in creatable ADO-recordset: Add fields
With ResultRS
With .Fields
.Append "CompID", adInteger
.Append "CompName", adVarChar, 255
.Append "BasicPrice", adVarChar, 255
End With
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.Open
End With
'Set Rowsource Listbox and subform
If ResultRS.RecordCount > 0 Then
strSearchResult = ResultRS.GetString(adClipString, , ";", ";")
Me.Formulier1.Form.Visible = True
Set Me.Formulier1.Form.Recordset = ResultRS
Me.CmbSearchResult.Visible = True
Me.CmbSearchResult.RowSource = strSearchResult
End If
SearchEnd:
'Clear memory
If rs.State = adStateOpen Then
rs.Close
Set rs = Nothing
End If
If ResultRS.State = adStateOpen Then
ResultRS.Close
Set ResultRS = Nothing
End If
Access2000.adp connected to SQL-server 2000
MainForm unbound: seachform on companies meeting a complex combination of
criteria.
SubFrom and ListBox to display the searchresult ( 2 outputs to test what's
best).
Searchresult is stored in a creatable ADO-recordset (see code) and then
1. Converted to string (GetString) to be set as valuelist for a listbox.
2. bound to the subform.
The Listbox shows the resultdata correctly but is limited in length.
The subform shows the records but all fields are empty or displays #error
How should I bound the controls correctly to display the fieldvalues?
If I let them unbound the show up empty.
If I set them to the recordsets' fieldnames it show #error.
On my Notebook using MSDE there is no errormessage
On my Desktop i get error 7965 not a valid recordset property.
CAN'T FIND WHAT'S WRONG! Cursortype ??
Filip
CODE
'Store result in creatable ADO-recordset: Add fields
With ResultRS
With .Fields
.Append "CompID", adInteger
.Append "CompName", adVarChar, 255
.Append "BasicPrice", adVarChar, 255
End With
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.Open
End With
'Set Rowsource Listbox and subform
If ResultRS.RecordCount > 0 Then
strSearchResult = ResultRS.GetString(adClipString, , ";", ";")
Me.Formulier1.Form.Visible = True
Set Me.Formulier1.Form.Recordset = ResultRS
Me.CmbSearchResult.Visible = True
Me.CmbSearchResult.RowSource = strSearchResult
End If
SearchEnd:
'Clear memory
If rs.State = adStateOpen Then
rs.Close
Set rs = Nothing
End If
If ResultRS.State = adStateOpen Then
ResultRS.Close
Set ResultRS = Nothing
End If