Textboxes Show 'AE' and other garbage text when using 3+ employees (1 Viewer)

TheDMinor

New member
Local time
Yesterday, 19:36
Joined
Jul 31, 2017
Messages
5
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:
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
 

Attachments

  • Works.PNG
    Works.PNG
    36.9 KB · Views: 176
  • doesntwork.PNG
    doesntwork.PNG
    29.5 KB · Views: 181

RuralGuy

AWF VIP
Local time
Yesterday, 18:36
Joined
Jul 2, 2005
Messages
13,826
To what *type* of value are you setting those Control Sources?
 

TheDMinor

New member
Local time
Yesterday, 19:36
Joined
Jul 31, 2017
Messages
5
The controlsources are being set to the fields under my MachineSpecific table, which the fields are hyperlinks.
 

TheDMinor

New member
Local time
Yesterday, 19:36
Joined
Jul 31, 2017
Messages
5
Oh wow, I changed it to "text" from "hyperlink" in the field type and it worked. Thanks for the help!
 

RuralGuy

AWF VIP
Local time
Yesterday, 18:36
Joined
Jul 2, 2005
Messages
13,826
I never liked HyperLink fields as they are strange. I use Text fields and then use the Click or DoubleClick event of the TextBox to take the user where they want to go.
 

Users who are viewing this thread

Top Bottom