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...the command button is only reading data from the LName text box. If data is entered into any other text box (and not LName), then the IndivData form pops up empty.
I am a bit new at coding, so I can't figure out why this is happening. I searched other threads and found similar issues, but nothing that would truely help me with my problem. 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!
Here's the code:
Tiffany
I am a bit new at coding, so I can't figure out why this is happening. I searched other threads and found similar issues, but nothing that would truely help me with my problem. 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!
Here's the code:
Code:
Private Sub btnFindBadgeData_Click()
On Error GoTo Err_btnFindBadgeData_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "IndivData"
stLinkCriteria = "[CardNum]=" & "'" & Me![CardNum] & "'"
stLinkCriteria = "[FName]=" & "'" & Me![FName] & "'"
stLinkCriteria = "[LName]=" & "'" & Me![LName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnFindBadgeData_Click:
Exit Sub
Err_btnFindBadgeData_Click:
MsgBox Err.Description
Resume Exit_btnFindBadgeData_Click
End Sub
Tiffany