T
Tiffany
I am fairly new to coding, so please bare with me. I have been working on
this code for weeks to get it to the point of where it is. I have a form
called (Find Employee) set up that is only used to find records from a table
(BadgeData) and returns the record on another form (IndivData). On the Find
Employee form, there are three text boxes that are unbound but exist in the
BadgeData table(Badge Number, FName, & LName). I created a command button
(btnFindBadgeData) to use the data entered on the Find Employee form, search
the BadgeData table and return the record on the IndivData form. The problem
is...no records are being returned. I get the message box saying no records
found even though the data I'm using to test the form came directly from the
record source table!!
I am a bit new at coding, so I can't figure out why this is happening. I
searched other threads and can't seem to find any that would help me. If
anyone can help me figure out what's wrong here or point me to a thread that
will help, I'd greatly appreciate it!
Code:
Private Sub btnFindBadgeData_Click()On Error GoTo Err_btnFindBadgeData_Click
Dim stDocName As String Dim stLinkCriteria As String stDocName =
"IndivData" If (stLinkCriteria = "[CardNum]=" & "'" & Me![CardNum] & "'" _
& "OR [FName]=" & "'" & Me![FName] & "'" _ & "OR [LName]=" &
"'" & Me![LName] & "'") Then DoCmd.OpenForm stDocName, , ,
stLinkCriteria Else Beep MsgBox "No employee data was
found." _ & vbCrLf & vbCrLf _ & "Please try again.",
vbInformation CardNum.SetFocus End If Me.[CardNum] = Null
Me.[LName] = Null Me.[FName] = NullExit_btnFindBadgeData_Click:
Exit SubErr_btnFindBadgeData_Click: MsgBox Err.Description Resume
Exit_btnFindBadgeData_Click End Sub
this code for weeks to get it to the point of where it is. I have a form
called (Find Employee) set up that is only used to find records from a table
(BadgeData) and returns the record on another form (IndivData). On the Find
Employee form, there are three text boxes that are unbound but exist in the
BadgeData table(Badge Number, FName, & LName). I created a command button
(btnFindBadgeData) to use the data entered on the Find Employee form, search
the BadgeData table and return the record on the IndivData form. The problem
is...no records are being returned. I get the message box saying no records
found even though the data I'm using to test the form came directly from the
record source table!!
I am a bit new at coding, so I can't figure out why this is happening. I
searched other threads and can't seem to find any that would help me. If
anyone can help me figure out what's wrong here or point me to a thread that
will help, I'd greatly appreciate it!
Code:
Private Sub btnFindBadgeData_Click()On Error GoTo Err_btnFindBadgeData_Click
Dim stDocName As String Dim stLinkCriteria As String stDocName =
"IndivData" If (stLinkCriteria = "[CardNum]=" & "'" & Me![CardNum] & "'" _
& "OR [FName]=" & "'" & Me![FName] & "'" _ & "OR [LName]=" &
"'" & Me![LName] & "'") Then DoCmd.OpenForm stDocName, , ,
stLinkCriteria Else Beep MsgBox "No employee data was
found." _ & vbCrLf & vbCrLf _ & "Please try again.",
vbInformation CardNum.SetFocus End If Me.[CardNum] = Null
Me.[LName] = Null Me.[FName] = NullExit_btnFindBadgeData_Click:
Exit SubErr_btnFindBadgeData_Click: MsgBox Err.Description Resume
Exit_btnFindBadgeData_Click End Sub