D
DataDiva via AccessMonster.com
Hello All,
I've been working on a database in Access 2007. It is used to track quality
data for Printed Circuit Boards that are serialized. The form that I am
working on: FrmBoardInspection is where general info about the board is
entered. This form has three command buttons, they are:
CmdRecordDefects - Opens up form to record defects related to PCB's on form.
CmdNewRecord - Saves record and re-populates the Assembly_Number, Process and
any other info that the user would otherwise have to enter for the next board,
assuming it was from the same job.
This button uses an embedded macro.
Action = OnError
Action = GoToRecord
Condition = [MacroError]<>0 Action = MsgBox Message = [MacroError].
[Description]
I am using this code in the form's On Current event:
Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone
If rs.EOF Or Not Me.NewRecord Then
' don't do anything if there's no records or it is not a new record
Else
With rs
.MoveLast
Me![JobNumber] = .Fields("Job_Number")
Me![cboDepartments] = .Fields("Department")
Me![InspectorID] = .Fields("Inspector_ID")
Me![PrevOperator] = .Fields("Previous_Operator")
Me![cboOp2] = .Fields("Op2_Number")
Me![CboOp3] = .Fields("Op3_Number")
Me![CboOp3] = .Fields("Op4_Number")
Me![JobFunction] = .Fields("Job_Function")
Me![Process] = .Fields("Process")
End With
If Me.NewRecord Then
Me.SerialNumber.SetFocus
Else
Me.TodaysDate.SetFocus
End If
If Me.NewRecord Then
Me.cboOp2.Enabled = False
Me.CboOp3.Enabled = False
Me.CboOp4.Enabled = False
End If
End If
End Sub
cmdNewInfo - This button clears the old info that has been re-populated by
cmdNewRecord once the user is ready to enter a new set of information.
I am using this code in the On Click event:
Private Sub CmdNewInfo_Click()
If Me.NewRecord Then
Me.Undo
End If
End Sub
What I would like to do is disable this cmdNewInfo until the user has saved
the previous record to prevent them from clearing information before saving
it. My coding skills are pretty amateur so any help would be appreciated.
Hope I have provided enough clear information.
Thanks,
Courtney
I've been working on a database in Access 2007. It is used to track quality
data for Printed Circuit Boards that are serialized. The form that I am
working on: FrmBoardInspection is where general info about the board is
entered. This form has three command buttons, they are:
CmdRecordDefects - Opens up form to record defects related to PCB's on form.
CmdNewRecord - Saves record and re-populates the Assembly_Number, Process and
any other info that the user would otherwise have to enter for the next board,
assuming it was from the same job.
This button uses an embedded macro.
Action = OnError
Action = GoToRecord
Condition = [MacroError]<>0 Action = MsgBox Message = [MacroError].
[Description]
I am using this code in the form's On Current event:
Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone
If rs.EOF Or Not Me.NewRecord Then
' don't do anything if there's no records or it is not a new record
Else
With rs
.MoveLast
Me![JobNumber] = .Fields("Job_Number")
Me![cboDepartments] = .Fields("Department")
Me![InspectorID] = .Fields("Inspector_ID")
Me![PrevOperator] = .Fields("Previous_Operator")
Me![cboOp2] = .Fields("Op2_Number")
Me![CboOp3] = .Fields("Op3_Number")
Me![CboOp3] = .Fields("Op4_Number")
Me![JobFunction] = .Fields("Job_Function")
Me![Process] = .Fields("Process")
End With
If Me.NewRecord Then
Me.SerialNumber.SetFocus
Else
Me.TodaysDate.SetFocus
End If
If Me.NewRecord Then
Me.cboOp2.Enabled = False
Me.CboOp3.Enabled = False
Me.CboOp4.Enabled = False
End If
End If
End Sub
cmdNewInfo - This button clears the old info that has been re-populated by
cmdNewRecord once the user is ready to enter a new set of information.
I am using this code in the On Click event:
Private Sub CmdNewInfo_Click()
If Me.NewRecord Then
Me.Undo
End If
End Sub
What I would like to do is disable this cmdNewInfo until the user has saved
the previous record to prevent them from clearing information before saving
it. My coding skills are pretty amateur so any help would be appreciated.
Hope I have provided enough clear information.
Thanks,
Courtney