BeardedSith
Member
- Local time
- Yesterday, 19:52
- Joined
- Feb 5, 2020
- Messages
- 73
This SHOULD be a no-brainer, but for some reason it's not working for me. I had it working shortly, then I changed the query and it stopped working. So I changed the query back and it's still not working, so there's obviously something else going on that I'm missing. Another set of eyes would be greatly appreciated.
From a report (rptIssueCards), the user will click on the "hyperlink" in txtFullName. This opens a form (frmRewardAssignment) to a specific record located in tblRewards. However, I also need info from tblMembers (First and Last names) on the form.
This entire routine has worked on numerous other forms, so I'm not entirely sure why it's not working here.
This procedure is on rptIssueCards:
And on frmRewardAssignment, this is the Form_Load() procedure:
The query for frmRewardAssignment is:
I have a feeling it has something to do with the JOIN. Being a complete idiot at SQL sometimes, I'm not entirely sure if INNER JOIN is the correct method here?
Every time I open frmRewardAssignment, it goes to a new record. The Debug.Print's are working correctly, though.
From a report (rptIssueCards), the user will click on the "hyperlink" in txtFullName. This opens a form (frmRewardAssignment) to a specific record located in tblRewards. However, I also need info from tblMembers (First and Last names) on the form.
This entire routine has worked on numerous other forms, so I'm not entirely sure why it's not working here.
This procedure is on rptIssueCards:
Code:
Private Sub txtFullName_Click()
On Error GoTo txtFullName_Click_Err
Dim i, frm As Access.Form
i = Nz(Me![txtRewardsID], "")
If Len(i) > 0 Then
DoCmd.OpenForm "frmRewardAssignment", acNormal, , , , , i
Else
DoCmd.OpenForm "frmRewardAssignment", acNormal
End If
txtFullName_Click_Exit:
Exit Sub
txtFullName_Click_Err:
MsgBox Error$
Resume txtFullName_Click_Exit
End Sub
And on frmRewardAssignment, this is the Form_Load() procedure:
Code:
Private Sub Form_Load()
On Error GoTo Form_Load_Err
DoCmd.MoveSize , , 5.3 * 1440, 3 * 1440
Dim CusID, rst As Recordset
CusID = Nz(Me.OpenArgs, 0)
Debug.Print CusID & "-1"
If CusID > 0 Then
Debug.Print CusID & "-2"
Set rst = Me.RecordsetClone
rst.FindFirst "ID = " & CusID
Debug.Print CusID & "-3"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
rst.Close
Else
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
End If
Form_Load_Exit:
Exit Sub
Form_Load_Err:
MsgBox Error$
Resume Form_Load_Exit
End Sub
The query for frmRewardAssignment is:
Code:
SELECT tblRewards.ID, [First Name] & " " & [Last Name] AS FullName, tblRewards.IssueDate, tblRewards.CardNumber, tblRewards.IssueAmount
FROM tblMembers INNER JOIN tblRewards ON tblMembers.ID = tblRewards.CustomerID;
I have a feeling it has something to do with the JOIN. Being a complete idiot at SQL sometimes, I'm not entirely sure if INNER JOIN is the correct method here?
Every time I open frmRewardAssignment, it goes to a new record. The Debug.Print's are working correctly, though.