Full_Williams
Registered User.
- Local time
- Today, 03:43
- Joined
- Jul 2, 2002
- Messages
- 88
Hi,
I'm doing the same function in 2 databases. The first database I created I used DAO. The second one I thought I would try using ADO. For some reason the database is running much slower with the ADO.
Basically what I'm doing is adding Members to a Meeting. I have 2 list boxes one on the left and one on the right of a form. The user will select Members to be invited to the meeting moving the member to the right (Invited list box). When I move through the meetings I have the code set to requery each list box so the Member and Invited members are reflected correctly for that meeting. Here is my code it's on the Current Event. If somebody could help me out here I would appreciate it.
Thanks,
Full Williams
Private Sub Form_Current()
Dim cnn As New ADODB.Connection
Dim rst0 As ADODB.Recordset
Dim rst1 As ADODB.Recordset
DoCmd.SetWarnings False
'clear invited Members
DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.Invited_Yes_No = No;"
Set cnn = CurrentProject.Connection
Set rst0 = New ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst0.Open "tblMemberInfo", cnn, adOpenDynamic, adLockOptimistic
rst1.Open "tblInvitedMembers", cnn, adOpenDynamic, adLockOptimistic
rst1.MoveFirst
Do Until rst1.EOF
rst0.MoveFirst
Do Until rst0.EOF
If rst1![MemberID] = rst0![MemberID] And rst1! [MeetingID] = Me.txtMeetingID Then
rst0!Invited_Yes_No = "True"
rst0.Update
End If
rst0.MoveNext
Loop
rst1.MoveNext
Loop
Me.lstInvitedMembers.Requery
Me.lstMembers.Requery
Me.txtRecordCount.Requery
Me.cmbMembership = Null
DoCmd.SetWarnings True
rst0.Close
rst1.Close
Set rst0 = Nothing
Set rst1 = Nothing
End Sub
I'm doing the same function in 2 databases. The first database I created I used DAO. The second one I thought I would try using ADO. For some reason the database is running much slower with the ADO.
Basically what I'm doing is adding Members to a Meeting. I have 2 list boxes one on the left and one on the right of a form. The user will select Members to be invited to the meeting moving the member to the right (Invited list box). When I move through the meetings I have the code set to requery each list box so the Member and Invited members are reflected correctly for that meeting. Here is my code it's on the Current Event. If somebody could help me out here I would appreciate it.
Thanks,
Full Williams
Private Sub Form_Current()
Dim cnn As New ADODB.Connection
Dim rst0 As ADODB.Recordset
Dim rst1 As ADODB.Recordset
DoCmd.SetWarnings False
'clear invited Members
DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.Invited_Yes_No = No;"
Set cnn = CurrentProject.Connection
Set rst0 = New ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst0.Open "tblMemberInfo", cnn, adOpenDynamic, adLockOptimistic
rst1.Open "tblInvitedMembers", cnn, adOpenDynamic, adLockOptimistic
rst1.MoveFirst
Do Until rst1.EOF
rst0.MoveFirst
Do Until rst0.EOF
If rst1![MemberID] = rst0![MemberID] And rst1! [MeetingID] = Me.txtMeetingID Then
rst0!Invited_Yes_No = "True"
rst0.Update
End If
rst0.MoveNext
Loop
rst1.MoveNext
Loop
Me.lstInvitedMembers.Requery
Me.lstMembers.Requery
Me.txtRecordCount.Requery
Me.cmbMembership = Null
DoCmd.SetWarnings True
rst0.Close
rst1.Close
Set rst0 = Nothing
Set rst1 = Nothing
End Sub