Subform2 change with record select on subform1

N

NNS2007

Hi Everyone!

I have a main form with tabs. On the Machine/Service tab I have Subfrom 1
that lists all machines owned by a customer, and subform 2 that lists all
service done on the machines owened by that customer.
Subform 1 is a continuos form showing each machine with model, serial#, date
installed, installer, and notes.
Subform 2 is a datasheet form showing Service ID, Service Type, Tech,
OpenDate, and CloseDate.
Right now all is OK but Subform 2 shows service for all machines owned by
the customer. I want Subform 2 to show service for only the record selcted in
Subform 1. So I can see service performed for each machine the customer has
when I'm on that record in Subform 1. Can anyone please help me here? Thanks!
 
F

Fred Loh

i assume machines and services are linked by ServiceID. On the form, in
either tab, create a textbox. lets call it "txtServiceID". in the machine
subform1, in the "Current" event, write "me.txtServiceID = me!ServiceID.". in
the service subform2, in the "Data" property, set the link child field to
ServiceID and set the link master field to txtServiceID".

fred
 
N

NNS2007

Hi Fred! Thanks for the try and I'm sorry I took so long to reply I have been
on the road for most of this time. I wasn't quite clear enough on what I'm
doing I think.
I have a Customers form that has 5 tabs. In order, the first tab is
Customers, then Contacts tab, Notes tab, Calls tab, and Machine/Service tab.
The Machine/Service tab has 2 subforms. The 1st for Machines the customer
ownes and the 2nd for Service performed on each machine. They are both linked
to the CustomerID.
The Record Source for the Machines subform is:
SELECT qrysubfrmMachine.MachineModel, qrysubfrmMachine.CoAddressID,
qrysubfrmMachine.MachineSerialNumber, qrysubfrmMachine.InstallDate,
qrysubfrmMachine.FirstName, qrysubfrmMachine.Notes
FROM qrysubfrmMachine;
This forms View is Continuous Forms

The Record Source for the Service subform is:
SELECT Service.ServiceID, Employees.FirstName, Service.ServiceType,
Service.DateOpened, Service.DateClosed, Service.CustomerID
FROM Employees INNER JOIN Service ON Employees.EmployeeID =
Service.EmployeeID;
This forms View is Datasheet

In the Machines subform I have all of the machines owned by the customer and
in the Service subform it shows ALL service done to ALL machines owned by the
customer. What I want is to have service done for one machine at a time
depending on the record selected in the Machines subform. I don't even care
if the Service subform shows anything before a record is selected in the
Machine subform.
I'm really stuck here!!! I hope someone can help
Thanks again!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top