jumpy record selector (1 Viewer)

ClaraBarton

Registered User.
Local time
Yesterday, 16:58
Joined
Oct 14, 2019
Messages
605
I have a subform with record selectors. The following is the form on click event:
Code:
Private Sub Form_Click()
Dim rs As Recordset
Set rs = Me.Parent.RecordsetClone

With rs
    .FindFirst "InvoiceID =" & Me.InvoiceID
        If Not .NoMatch Then
        Me.Parent.Bookmark = rs.Bookmark
        End If
End With
Set rs = Nothing

End Sub
The proper record is selected in the parent form but the continuous form subform selector jumps back to the first record. I can click the selector the second time and it stays. There is no other code in this module. There is no requery. It works fine but it doesn't look right because the two forms are on different records.
 
Are you trying to emulate a split form?
 
maybe put the bookmark of the subform to the variable.
after you set the bookmark of the parent form, you again set the bookmark of the subform to the value of your variable.
Code:
Private Sub Form_Click()
Dim bm As Variant
Dim rs As Recordset
Set rs = Me.Parent.RecordsetClone
'save the bookmark
bm = Me.Bookmark
With rs
    .FindFirst "InvoiceID =" & Me.InvoiceID
        If Not .NoMatch Then
        Me.Parent.Bookmark = rs.Bookmark
        End If
End With
'reinstate the bookmark
Me.bookmark = bm
Set rs = Nothing
End Sub
 
I have a subform with record selectors. The following is the form on click event:
Code:
Private Sub Form_Click()
Dim rs As Recordset
Set rs = Me.Parent.RecordsetClone

With rs
    .FindFirst "InvoiceID =" & Me.InvoiceID
        If Not .NoMatch Then
        Me.Parent.Bookmark = rs.Bookmark
        End If
End With
Set rs = Nothing

End Sub
The proper record is selected in the parent form but the continuous form subform selector jumps back to the first record. I can click the selector the second time and it stays. There is no other code in this module. There is no requery. It works fine but it doesn't look right because the two forms are on different records.
Which sub-form?
 
Seems backward to me.?
I would expect to select a record on the mainform and see related records in the subform?
If you are indeed trying to emulate a split form, then search here for 'emulated split form' by @MarkK I seem to recall.
 
 
Click in bottom subform to change invoice record.
That sub-form I created for you is ONLY for viewing purposes. You cannot select records as other forms. I had vertical scrollbars set. Leave those forms alone. They worked perfectly when I sent the file to you.
 
Last edited:
I have a subform with record selectors. The following is the form on click event:
Code:
Private Sub Form_Click()
Dim rs As Recordset
Set rs = Me.Parent.RecordsetClone

With rs
    .FindFirst "InvoiceID =" & Me.InvoiceID
        If Not .NoMatch Then
        Me.Parent.Bookmark = rs.Bookmark
        End If
End With
Set rs = Nothing

End Sub
The proper record is selected in the parent form but the continuous form subform selector jumps back to the first record. I can click the selector the second time and it stays. There is no other code in this module. There is no requery. It works fine but it doesn't look right because the two forms are on different records.
I can see no reason for this code. The summary sub-form is linked to each customer. It shows all invoices for that customer. The form is linked using NameID as Master Link and fNameID as Child Link. I don't understand what this code is supposed to do.
 
Here is the file I gave you before. The Invoice report wasn't working properly either so now it is.
 
I followed your instructions. It works and I thank you. However, I need to see detail on the other invoices from the same customer. How would I do that? This works, not? Don't you just hate it when people don't follow the rules?
 
I followed your instructions. It works and I thank you. However, I need to see detail on the other invoices from the same customer. How would I do that? This works, not? Don't you just hate it when people don't follow the rules?
Then I'll have to create another report that shows all invoices by customer. I'll put a button on the customer name form that will open the report. I'll attach the new file soon.
 
Why? This works! Did you look at it?
The report only shows the invoice that is active. It doesn't show all invoices for customers with multiple invoices. I am working to print the report with all invoices for the selected customer. Just like you asked for.
 
Here is the file with a new Preview Customer Report button to report all invoices for each customer.
 

Attachments

Sorry, it shows all invoices for the customer. Click on the invoice and it shows the detail. Click on preview and it prints it out. No fuss. I only wish it wouldn't jump back to the first after selecting another. I shall try arnelgp's code. Just look at it once. By the way, I did look at yours. Thanks for your help.
 
Arnelgp... Your code fixed the jumpy problem. Thank you so much!
 

Users who are viewing this thread

Back
Top Bottom