Good morning to all, I am a coop for a company and I am designing a database/interface so they can use it on the shop floor without using books. I am having an issue with my textboxes on my form. Whenever I use only 1 or 2 employee accounts (IDnumber,LastName,FirstName) the textboxes on my form displays the correct machine info. However, when I have 3+ employee accounts, the text boxes on my form shows all trash info.
Here is my code for my 'LookUp' button and pictures of what the form does once I have 2 employee accounts then 3+ accounts:
Here is my code for my 'LookUp' button and pictures of what the form does once I have 2 employee accounts then 3+ accounts:
Code:
Private Sub Look_Up_Click()
If IsNull(Me.cbobMachine + Me.cbobPart + Me.cbobOperation) Then
MsgBox "You MUST enter the Part," & vbCrLf & _
"Operation, AND Machine Numbers.", _
vbCritical, _
"Canceling Look Up"
If IsNull(Me.cbobPart) Then
Me.cbobPart.SetFocus
ElseIf IsNull(Me.cbobOperation) Then
Me.cbobOperation.SetFocus
Else: Me.cbobMachine.SetFocus
End If
Cancel = True
If Cancel = True Then
Exit Sub
End If
End If
If IsNull(Me.txtSerialNumber + Me.txtOperatorNumber) Then
MsgBox "The Serial AND Operator" & vbCrLf & _
"Numbers MUST all be entered.", _
vbCritical, _
"Canceling Look Up"
If IsNull(Me.txtSerialNumber) Then
Me.txtSerialNumber.SetFocus
Else: Me.txtOperatorNumber.SetFocus
End If
Cancel = True
If Cancel = True Then
Exit Sub
End If
End If
x = DCount("*", "[EmployeeNumbers]", "[IDNumber] = '" & Me.txtOperatorNumber & "'")
If x > 0 Then
Dim strInsert As String
strInsert = "INSERT INTO [Op/SerialNumber](SerialNumber, OperatorNumber) VALUES ('" & Me.txtSerialNumber & "', '" & Me.txtOperatorNumber & "')"
Debug.Print strInsert
CurrentDb.Execute strInsert, dbFailOnError
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[MachineNumber] = '" & Me![cbobMachine] & "' And [PartNumber] = '" & Me![cbobPart] & "' And [OperationNumber] = '" & Me![cbobOperation] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Else
MsgBox "The Operator Number MUST" & vbCrLf & _
"be a valid Employee Number.", _
vbCritical, _
"Canceling Look Up"
Me.txtOperatorNumber.SetFocus
Cancel = True
If Cancel = True Then
Exit Sub
End If
End If
Me!SetupSheets.ControlSource = "[SetupSheets]"
Me!ToolSheets.ControlSource = "[ToolSheets]"
Me!NCProgramReference.ControlSource = "[N/CProgramReference]"
Me!OperatorInstructions.ControlSource = "[OperatorInstructions]"
Me!PartHandlingInstructions.ControlSource = "[PartHandlingInstructions]"
Me!OperatorNotes.ControlSource = "[OperatorNotes]"
Me!InspectionTools.ControlSource = "[InspectionTools]"
Me!OperationSketches.ControlSource = "[OperationSketches]"
Me!BuyOut.ControlSource = "[BuyOut]"
Me.Look_Up.Enabled = False
End Sub