Linking dialogue forms

ECEK

Registered User.
Local time
Today, 18:24
Joined
Dec 19, 2012
Messages
717
I have two tables. Table1 is a list of customers. Table is a list of notes about the customers. They both have forms. What I want to do is view Form1 and when I click on a name is open the the notes form in data only format. I can do all this but im stuggling to link the forms so that the data I write in the notes form is linked to the person I clicked on the customers form. Thanks gang.
 
I take it the 2nd table has a column with the first tables customer number? That's what you'd need to link them. You can do an onclick event that opens the second form (which has the default view as Datasheet. Set "Allow Datasheet View" to Yes) with a Where condition set to have the ID field match what the 1st form is.

Example Macro in Where Condition
Code:
[notesID]=[Forms]![FirstForm]![txtSelectCustomer]
 
What I want to do is open the form in dialogue
 
Then additionally set Pop Up to Yes.
 
This simply doesn't work. I've tried all of your suggestions and whilst I can get Form2 to open it doesn't auto populate the ID field with the ID of the person on Form1
 
I dont want to open an existing record. I want to creat a new one every time I open Form2
 
hmm I think I see what you're trying to do with that extra information.

You want to be able to click a name from form1 - have form2 show any previous notes in datasheet view but additionally enter the customerID in the new record row of that datasheet view.

You *may* be able to do it by vba moving to next row but I'm not sure how it would then select the notes column.

A possibility would be to when clicking the name have it vba insert a new record then do a doCmd and switch the form to acFormDS - but you still wouldn't select the new table row that's entered - it would however have entered the customerID for you.

outside of controlling the action by opening a new form, entering data, and closing it/opening the form again in datasheet view - i'm not sure how to accomplish what you're trying to do. Datasheet view is just that, as a table.
 
I think the easiest way to explain is to run through how you would manually do it i.e.
Copy the ID on Form1 then open Form2 and paste the ID into the ID of Form2 then start to write the notes.
 
I thought I'd Ive solved it.
Form2 has a query as its data source. The query is Table1 and Table2 Linked together by ID.
My fields on Form2 are Table1.ID and Table2 Notes.
I then have an onclick to open Form2 where the ID on Form1 = table1.ID on Form2.
This is effectively the same data.
I add my notes and close the form.
I can now have another button on my Form to review my entries for each person.

It's OK for entering one note at a time.
 
Last edited:
I have solved it.
You just create Form2 which has Table1 ID as the data, then create Form3 with the data source as Table2 then make Form3 a sub form of Form2. Voila.
You can now open Form2 from Form1with the ID as the link then any data put into (sub)Form3 will be populated with the ID and subsequently linkable.
 

Users who are viewing this thread

Back
Top Bottom