S
sam
Hi,
I have an unbound form and am using a combo box with the
after update event to populate the form. Also running
similar code for add new, update, delete. All works
perfectly as I want it in Access 2000, nice and fast, no
problems at all. The problem is I have to build it in
Access 2000 and run it in Access 97. When I convert to 97
The problems start. The error I'm getting points
to "currentproject.connection" something about an
undecleared variable. (there could be other problems but
I haven't got past this one yet so I don't know)
Any help greatly appreciated.
Private Sub cboSupSch_AfterUpdate()
Dim cnnlocal As New ADODB.Connection
Dim rstcurr As New ADODB.Recordset
Dim fldcurr As ADODB.Field
Set cnnlocal = CurrentProject.Connection
rstcurr.Open "select * from tblcontact where contactids
= " & Forms!frmcontact!cboSupSch & ";", cnnlocal, _
adOpenKeyset, adLockPessimistic
With rstcurr
Me.txtContactIDS = !ContactIDS
Me.cboSalutation = !SalutationID
Me.txtFirstNm = !FirstNm
Me.txtLastNm = !LastNm
Me.txtAddr1 = !Addr1
Me.txtAddr2 = !Addr2
Me.cboSurb = !SurbID
Me.txtCity = !City
Me.txtPhone1 = !Phone1
Me.txtPhone1Extn = !Phone1Extn
Me.txtPhone2 = !Phone2
Me.txtPhone2Extn = !Phone2Extn
Me.txtFax = !Fax
Me.txtMobile = !Mobile
Me.txtEmail = !Email
Me.txtNotes = !Notes
End With
'clean up
rstcurr.Close
Set rstcurr = Nothing
End Sub
I have an unbound form and am using a combo box with the
after update event to populate the form. Also running
similar code for add new, update, delete. All works
perfectly as I want it in Access 2000, nice and fast, no
problems at all. The problem is I have to build it in
Access 2000 and run it in Access 97. When I convert to 97
The problems start. The error I'm getting points
to "currentproject.connection" something about an
undecleared variable. (there could be other problems but
I haven't got past this one yet so I don't know)
Any help greatly appreciated.
Private Sub cboSupSch_AfterUpdate()
Dim cnnlocal As New ADODB.Connection
Dim rstcurr As New ADODB.Recordset
Dim fldcurr As ADODB.Field
Set cnnlocal = CurrentProject.Connection
rstcurr.Open "select * from tblcontact where contactids
= " & Forms!frmcontact!cboSupSch & ";", cnnlocal, _
adOpenKeyset, adLockPessimistic
With rstcurr
Me.txtContactIDS = !ContactIDS
Me.cboSalutation = !SalutationID
Me.txtFirstNm = !FirstNm
Me.txtLastNm = !LastNm
Me.txtAddr1 = !Addr1
Me.txtAddr2 = !Addr2
Me.cboSurb = !SurbID
Me.txtCity = !City
Me.txtPhone1 = !Phone1
Me.txtPhone1Extn = !Phone1Extn
Me.txtPhone2 = !Phone2
Me.txtPhone2Extn = !Phone2Extn
Me.txtFax = !Fax
Me.txtMobile = !Mobile
Me.txtEmail = !Email
Me.txtNotes = !Notes
End With
'clean up
rstcurr.Close
Set rstcurr = Nothing
End Sub