W
Webtechie
Hello,
I am struggling to understand disconnected recordsets.
I have a form that opens and using VBA, I am creating a recordset.
Great.
Then while in another sub routine, I open another form for data entry. I've
tried to reconnect to the disconnected recordset and it doesn't work.
So I've set the recordset (rsGuestData) to a new recordset
set rsGuestData = NEW ADODB.RECORDSET
1) open that recordset
2) Populate fields
With rsGuestData
.Source = mySQL
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open Options:=adCmdText
.MoveLast
rsGuestCount = .Bookmark
End With
With frmKeyLeads
If Len(rsGuestData!firstname) > 0 Then
.txtFirstName.Text = rsGuestData!firstname
End If
If Len(rsGuestData!lastname) > 0 Then
.txtLastName.Text = rsGuestData!lastname
End If
If Len(rsGuestData!telephone) > 0 Then
.txtTelephone.Text = CStr(rsGuestData!telephone)
End If
Question
1) Why do I have to create a new recordset?
2) Is it that you can't reference a disconnected recordset from a different
procedure/sub routine?
I appreciate any help on this.
Tony
I am struggling to understand disconnected recordsets.
I have a form that opens and using VBA, I am creating a recordset.
Great.
Then while in another sub routine, I open another form for data entry. I've
tried to reconnect to the disconnected recordset and it doesn't work.
So I've set the recordset (rsGuestData) to a new recordset
set rsGuestData = NEW ADODB.RECORDSET
1) open that recordset
2) Populate fields
With rsGuestData
.Source = mySQL
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open Options:=adCmdText
.MoveLast
rsGuestCount = .Bookmark
End With
With frmKeyLeads
If Len(rsGuestData!firstname) > 0 Then
.txtFirstName.Text = rsGuestData!firstname
End If
If Len(rsGuestData!lastname) > 0 Then
.txtLastName.Text = rsGuestData!lastname
End If
If Len(rsGuestData!telephone) > 0 Then
.txtTelephone.Text = CStr(rsGuestData!telephone)
End If
Question
1) Why do I have to create a new recordset?
2) Is it that you can't reference a disconnected recordset from a different
procedure/sub routine?
I appreciate any help on this.
Tony