Good morning!
I have a Jobs form which calls a Job Search form with a button. The job form is populated from the jobs table, with Customer name from the Customer table and Factory name from the Factory table. The Recordsource for the Jobs form is set from a query I built:
The Job Search form has 2 listboxes. The first one is to search for the customer and has a textbox (txtSearch) that activates a "search as you type" query. The Row Source for the Customer listbox is a query:
and the On Change event of the text box contains the following code:
This works perfectly. I then have a second list box which displays all the jobs for the customer selected in listbox 1. The box populates properly, but the textbox doesn't activate a "search as you type" action. As far as I can see, I have all the same code as for the first list box and have changed the name of the search textbox to txtSearchJob and the listbox name to lstJobName.
The On Change event of txtSearchJobs contains the code
Nothing changes in the Job Name list box when I type in the txtSearchJob textbox and I cannot see why!
Second problem is once I selectthe required job, I'm not sure how to change the recordsource for frmJobs to load the selected job. I have tried every which way I can think of with varying results - I managed to get the correct job loaded, but got a #NAME? for the Customer Name. Now I can't get the correct job loaded ... how do I get the Jobs form to load the Job selected in the list box, as well as getting the Customer Name from the Customer Table and the Factory Name from the Factory table?
I am currently setting the recordsource of the Jobs form on selecting a job to this (I don't even know how I got here any more
)
Forms!frmJobs.RecordSource = "SELECT Jobs.*, Customer.CustName, Factory.FactoryName FROM Factory INNER JOIN (Customer INNER JOIN Jobs ON Customer.CustCode = Jobs.CustCode) ON Factory.FactoryCode = Jobs.FactoryCode WHERE (Customer.[CustCode])= Me.lstCustName" but it asks for a parameter value for lstCustName (which is the cust code) - I have checked (via textboxes on the form) that the ListIndex for both listboxes are correct.
Hope this makes sense to someone.....
I have a Jobs form which calls a Job Search form with a button. The job form is populated from the jobs table, with Customer name from the Customer table and Factory name from the Factory table. The Recordsource for the Jobs form is set from a query I built:
Code:
SELECT Jobs.*, Customer.CustName, Factory.FactoryName FROM Factory INNER JOIN (Customer INNER JOIN Jobs ON Customer.CustCode = Jobs.CustCode) ON Factory.FactoryCode = Jobs.FactoryCode;
The Job Search form has 2 listboxes. The first one is to search for the customer and has a textbox (txtSearch) that activates a "search as you type" query. The Row Source for the Customer listbox is a query:
and the On Change event of the text box contains the following code:
Code:
'Check if something has been typed in the search box. If not get no. of characters in search box for search query
If blnSpace = False Then
Me.Requery
Refresh
txtSearch.SetFocus
txtSearch.SelStart = Len(Me.txtSearch.Text)
End If
The On Change event of txtSearchJobs contains the code
Code:
If blnSpace = False Then
Me.Requery
Refresh
txtSearchJob.SetFocus
txtSearchJob.SelStart = Len(Me.txtSearchJob.Text)
End If
Second problem is once I selectthe required job, I'm not sure how to change the recordsource for frmJobs to load the selected job. I have tried every which way I can think of with varying results - I managed to get the correct job loaded, but got a #NAME? for the Customer Name. Now I can't get the correct job loaded ... how do I get the Jobs form to load the Job selected in the list box, as well as getting the Customer Name from the Customer Table and the Factory Name from the Factory table?
I am currently setting the recordsource of the Jobs form on selecting a job to this (I don't even know how I got here any more

Forms!frmJobs.RecordSource = "SELECT Jobs.*, Customer.CustName, Factory.FactoryName FROM Factory INNER JOIN (Customer INNER JOIN Jobs ON Customer.CustCode = Jobs.CustCode) ON Factory.FactoryCode = Jobs.FactoryCode WHERE (Customer.[CustCode])= Me.lstCustName" but it asks for a parameter value for lstCustName (which is the cust code) - I have checked (via textboxes on the form) that the ListIndex for both listboxes are correct.
Hope this makes sense to someone.....