Having trouble opening form to specific record (1 Viewer)

BeardedSith

Member
Local time
Today, 18:10
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:
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:10
Joined
Oct 29, 2018
Messages
14,574
Hi. Just a quick check to make sure the form is not set to Data Entry. Is it?
 

BeardedSith

Member
Local time
Today, 18:10
Joined
Feb 5, 2020
Messages
73
Hi. Just a quick check to make sure the form is not set to Data Entry. Is it?
It is. Should it not be? The goal here is to assign a customer a card number on this form.

EDIT: Whelp...that worked. I guess that's all I had wrong hah. Thanks!!!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:10
Joined
Oct 29, 2018
Messages
14,574
It is. Should it not be? The goal here is to assign a customer a card number on this form.

EDIT: Whelp...that worked. I guess that's all I had wrong hah. Thanks!!!
Hi. Glad to hear you got it sorted out. The Data Entry property can be confusing sometimes. Good luck with your project.
 

Users who are viewing this thread

Top Bottom