B
BrianDP
Here's my code.. Open a form, and find the record number in Lcontrol!
lastcust. But that last Msgbox MUST be there or the script ceases to
function correctly.
Private Sub cmdaccount_Click()
Dim cc As Integer
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("lcontrol")
rst.MoveFirst
cc = rst!lastcust
rst.Close
DoCmd.OpenForm "customer definition"
If Nz(cc) <> 0 Then
Forms("Customer definition").Recordset.FindFirst "cust_code = " & cc
End If
'VVVVVVV Right here, this msgbox, if I remove it, the script still
runs, but it does NOT open to CC. I suspect it
'VVVVVVV DOES open to cc, but then for some reason it moves off of
that record. Any clues?
MsgBox cc
End Sub
lastcust. But that last Msgbox MUST be there or the script ceases to
function correctly.
Private Sub cmdaccount_Click()
Dim cc As Integer
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("lcontrol")
rst.MoveFirst
cc = rst!lastcust
rst.Close
DoCmd.OpenForm "customer definition"
If Nz(cc) <> 0 Then
Forms("Customer definition").Recordset.FindFirst "cust_code = " & cc
End If
'VVVVVVV Right here, this msgbox, if I remove it, the script still
runs, but it does NOT open to CC. I suspect it
'VVVVVVV DOES open to cc, but then for some reason it moves off of
that record. Any clues?
MsgBox cc
End Sub