rainman89
I cant find the any key..
- Local time
- Today, 17:46
- Joined
- Feb 12, 2007
- Messages
- 3,013
here is the entire code
i had the newrec code and thought the same thing, so i removed it, and its still doing the same thing.
Code:
Private Sub saveRecord_Click()
On Error GoTo Err_saveRecord_Click
If IsNull(Me.txtExpenseDate) Or IsNull(Me.cboCaseNumber) Or IsNull(Me.txtExpenseAmount) Then
Beep
MsgBox "All required fields must be completed before you can save a record.", vbCritical, "Invalid Save"
Exit Sub
End If
Beep
Select Case MsgBox("Do you want to save your changes to the current record?" & vbCrLf & vbLf & " Yes: Saves Changes" & vbCrLf & " No: Does NOT Save Changes" & vbCrLf & " Cancel: Reset (Undo) Changes" & vbCrLf, vbYesNoCancel + vbQuestion, "Save Current Record?")
Case vbYes: 'Save the changes
Me.CLICKSAVE.Value = "Yes"
Dim rs As Recordset
Dim c As Control
Dim str As String
Set rs = Me.RecordsetClone
For Each c In Me.Controls
str = c.Name
If TypeOf c Is ComboBox Then
If Not IsNull(c) Then
If str Like "cbocase*" Then
With rs
.AddNew
!CaseID = c
!ExpenseTypeID = Me.cboExpenseType
!ExpenseName = Me.txtExpenseName
!PaymentMethodID = Me.cboPaymentMethod
!ExpenseAmount = Me.txtExpenseAmount
!ExpensePaidTo = Me.txtExpensePaidTo
!ExpenseAdditionalInfo = Me.txtExpenseAdditionalInfo
!TaskID = Me.TaskID
!ExpenseAddedby = Me.txtEmpInitials
!DateExpenseAdded = Me.TODAYDATE
!ExpenseReimbursement = Me.chkAssigntoAgent
!EmployeeID = Me.EmployeeID
!ExpenseDate = Me.txtExpenseDate
.Update
End With
End If
End If
End If
Next
Case vbNo: 'Do not save or undo
'Do nothing
Case vbCancel: 'Undo the changes
DoCmd.RunCommand acCmdUndo
Me.CLICKSAVE.Value = "No"
Case Else: 'Default case to trap any errors
'Do nothing
End Select
Exit_saveRecord_Click:
Exit Sub
Err_saveRecord_Click:
If Err = 2046 Then 'The command or action Undo is not available now
Exit Sub
Else
MsgBox Err.Description
Resume Exit_saveRecord_Click
End If
End Sub
i had the newrec code and thought the same thing, so i removed it, and its still doing the same thing.