Question : ADO.connection does not work for endless form

With the attached code, I only get the recordsets one by one in my access form, even I have defined the form as endless. Does this not work as a feed for endless form. And secondly, I noticed that when I get the single rs, I can't make any changes. I assume this is because I need a pass-trough-code, but the one offerred by MS (http://support.microsoft.com/kb/304323/de) hasn't worked
thx for any input
rgds
Kongta
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Private Sub Form_Load()
Dim cmd As ADODB.Command
Dim c As ADODB.Connection
Dim rs As New Recordset
Dim Srv As Variant
Dim DB As Variant

Set c = New ADODB.Connection
c.ConnectionString = "Driver={SQL Server};Server=" & Srv & ";Database=" & DB & ""
c.Open
Set rs = New ADODB.Recordset
rs.LockType = adLockOptimistic
rs.CursorType = adOpenDynamic
rs.CursorLocation = adUseServer

rs.Open "dbo.tblWBI", c
Me.Bez = rs!Symbol

End Sub

Answer : ADO.connection does not work for endless form

You only set a Recordset ONCE, in the Open event of your form. However, I think you're using the term "recordset" incorrectly ... a Recordset set is a group of records; a Record is one of those records, and it's generally what you work with on a Form.

You haven't "set" your recordset to the form's recordset. You do that like this:

Set Me.Recordset = rst

You do this AFTER you fully open the recordset. From that point, you would work with the form's controls - textboxes, combos, etc - just as you would a form bound to a local table.

If you want to work with fully unbound forms, then you'll have to do a LOT more work.


Random Solutions  
 
programming4us programming4us