473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Cycling through a subform record from the master form

Hi
I have a form called Invoice that has a subform called Invoice_datasheet. The subform has the field Customer as the child link and Customer_Name in the Invoice form (The master) as the master link which means I have 2 tables as well.
since my Invoice field is opened by a command button from another form, it is filtered out so that only one customer's invoices are shown at a time.
On the other hand, I have a searchbox in the form Invoice to look up any Invoice ID for any customer and it has the following vb code:

If Not IsNull(Forms![Invoice]![searchbox]) Then

Me.Filter = ""

Dim rs As Object
Dim strLinkValue As String

strLinkValue = Me![searchbox].Value
Set rs = Me.RecordsetClone
rs.FindFirst "[Invoice ID]=" & strLinkValue & ""
Forms!Invoice.Bookmark = rs.Bookmark
End If

The searchbox works perfectly but I want to create two buttons (Previous and Next) that cycle through the Invoices for the current customer. The two buttons work perfectly if the filter is on, but after I use the searchbox to look up an InvoiceID, the filter gets cleared out so those two buttons will cycle through all the invoices and not just through the invoices for the current customer.
How can I fix this? Is there any way to apply a filter so only current customer's invoices will be cycled?

Any help will be greatly appreciated and sorry for the long post
Jul 25 '09 #1
1 1976
ChipR
1,287 Expert 1GB
As a user, I wouldn't expect choosing an invoice number to filter the recordset by customer. But if that's what you want to do, just add the lines
Expand|Select|Wrap|Line Numbers
  1. Me.Filter = "[Customer_Name] = '" & Customer_Name & "'"
  2. Me.FilterOn = True
This assumes Customer_Name is a text field. If it's numeric, the single quotes aren't needed.
Jul 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: YFS DBA | last post by:
How do I use VBA to insert a *new* record into a subform? I have a master form with client information, and a sub form with billing information. I want to click on a button ("Add Data") and have...
2
by: chrisM | last post by:
Hi, Hope someone can help me. I have the following setup in an Access database A master form 'Customers' in 'Single Form' view that has a RecordSource of 'myCustomerTable' CustomerCode...
6
by: Ray | last post by:
I have a main form with a subform. The main form has a combo box which lists all the clients which in turn are displayed in the subform. The subform is bound to the combo box and all work well....
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
4
by: | last post by:
This is blowing my mind because I thought this setup was working.... How is a new record generated in the table of a Child subform whenever a new record is generated in the table of the Master...
1
by: kkrizl | last post by:
I have a form that displays general information about an alarm permit location. There's a subform that shows detailed information about burglar alarms that have gone off at the location. When a...
5
by: jpatchak | last post by:
Hello, I'm hoping someone can help me. I have a mainform based on a table (let's call it tblMain) with a Primary Key of . There is a subform on this main form based on another table (let's call...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
12
by: banderson | last post by:
Hello all, I am hoping that you can help me with a problem that has occurred numerous times on various forms in the two databases that I am working on. When I first add a subform to a form linking...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.