T
Tom
I recently had a new server installed and now the event procedure doesn't
work like it did before. What could have effected the procedure?
It actually performs a portion of the routine (creates 6 new numbers) and
then stops.
The Event Procedure is shown below.
Private Sub btnInvNo_s_Click()
On Error GoTo Err_btnInvNo_s_Click
'This function generates incremental Invoice Numbers for invoices in
'the table "1WEEK". The first invoice number is the last/maximum invoice
'number in a table called "Inv List"
Dim dblInvNo As Double
Dim db As Database
Dim Rs As Recordset
Dim IntMax As Integer 'holds the number of records in table "1WEEK"
Dim IntRec As Integer
Dim x As Integer
'Dim IntI As Integer
Dim IntNoRecords As Integer
Dim dblNewInvNo As Double
Dim dblLastInc As Double
dblInvNo = DMax("[INVNO]", "Inv List")
dblNewInvNo = dblInvNo + 1
Set db = DBEngine.Workspaces(0).Databases(0)
Set Rs = db.OpenRecordset("1WEEK", DB_OPEN_TABLE)
Rs.Index = "CUST/CUSTNO/EMPNAME" ' Set current index.
With Rs
'Counting total number of records. This task should be handled in the
'Form_Load event.
.MoveLast
IntMax = .RecordCount
.MoveFirst
'.Edit
'![INVNO] = dblNewInvNo
'.UPDATE
For x = 1 To IntMax
If x = 1 Then
.Edit
![INVNO] = dblNewInvNo
dblLastInc = ![INVNO]
.Update
.MoveNext
Else
.Edit
![INVNO] = dblLastInc + 1
dblLastInc = ![INVNO]
.Update
.MoveNext
End If
Next
End With
db.Close
Me.Refresh
Exit_btnInvNo_s_Click:
Exit Sub
Err_btnInvNo_s_Click:
MsgBox Error$
Resume Exit_btnInvNo_s_Click
End Sub
work like it did before. What could have effected the procedure?
It actually performs a portion of the routine (creates 6 new numbers) and
then stops.
The Event Procedure is shown below.
Private Sub btnInvNo_s_Click()
On Error GoTo Err_btnInvNo_s_Click
'This function generates incremental Invoice Numbers for invoices in
'the table "1WEEK". The first invoice number is the last/maximum invoice
'number in a table called "Inv List"
Dim dblInvNo As Double
Dim db As Database
Dim Rs As Recordset
Dim IntMax As Integer 'holds the number of records in table "1WEEK"
Dim IntRec As Integer
Dim x As Integer
'Dim IntI As Integer
Dim IntNoRecords As Integer
Dim dblNewInvNo As Double
Dim dblLastInc As Double
dblInvNo = DMax("[INVNO]", "Inv List")
dblNewInvNo = dblInvNo + 1
Set db = DBEngine.Workspaces(0).Databases(0)
Set Rs = db.OpenRecordset("1WEEK", DB_OPEN_TABLE)
Rs.Index = "CUST/CUSTNO/EMPNAME" ' Set current index.
With Rs
'Counting total number of records. This task should be handled in the
'Form_Load event.
.MoveLast
IntMax = .RecordCount
.MoveFirst
'.Edit
'![INVNO] = dblNewInvNo
'.UPDATE
For x = 1 To IntMax
If x = 1 Then
.Edit
![INVNO] = dblNewInvNo
dblLastInc = ![INVNO]
.Update
.MoveNext
Else
.Edit
![INVNO] = dblLastInc + 1
dblLastInc = ![INVNO]
.Update
.MoveNext
End If
Next
End With
db.Close
Me.Refresh
Exit_btnInvNo_s_Click:
Exit Sub
Err_btnInvNo_s_Click:
MsgBox Error$
Resume Exit_btnInvNo_s_Click
End Sub