Information in sub form

A

Afrosheen

I have 2 forms. Main form 1 and a sub form. I'm using 2 tables. Table 1 for
the main form and table 2 for the sub form. Table 2 is a table with a memo
field in it for instructions on how to Delete a Record or something else. Sub
form 2 is a general form and I want to use it in other forms so I can give
other instructions. What I need to do is open the Main form and when the sub
form comes up I want to have sub form display the header {instruction title}
and the memo box on how to do something. I don't want to build querys for
about 10 to 15 instructions. Is there any way the main form can look up the
information in table 2 and have it displayed in the sub form?

Also; when I click on the memo box to scroll down it is highlighted. Any way
of stopping that?

Sorry, I'm new to this so you'll have to show me the coding in VB.

Thanks
 
K

Ken Sheridan

When opening the second form from the main form filter the second form by
means of the WhereCondition argument of the OpenForm method. So the code to
do this, which could go in the Click event procedure of a 'Help' button on
the main form for instance, would be like this:

Const conform = "Form2"
Dim strCriteria As String

strCriteria = "[Instruction Title] = """ & Me.[Instruction Title] & """"

DoCmd.OpenForm, conForm, WhereCondtion:=strCriteria

Change Form2 and Instruction Title to the actual names of the second form
and the field in table 2 and control on the main form which contains the
instruction title value.

I've frequently used a similar method to this to create a simple Help
system, where the main form contains a list box listing all the 'instruction
titles' (from a table). The list box is the control referred to in the code.
The second form is based on another table which, like yours, contains a memo
field as well as the instruction title column. The code goes in the Click
event of a button on the first form, and in the list box's DblClick event
procedure so a user can simply double-click the item in the list to open the
second form at that topic.

Ken Sheridan
Stafford, England
 

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

Similar Threads


Top