Subform and Look-up Box

A

aubrey

Good Morning All,

I have a from "General" and a subfom "ProposedReg," I have a relationship
that connects the two so that when I select a Reg on the General form the
related ProposedReg come up on the subform.

I would like to create a look-up box on the ProposedReg from that would
look-up the Proposed Regs. The problem that I've encountered is that when I
create a look-up box it lists all of the Proposed Regs that I have in my
table, I would only like it to list all of the Proposed Regs as it relates to
the Reg that I selected on my General form.

If anyone can point me in the right direction, that would be great.

Thanks,
 
D

Damon Heron

Open your form in design view, with the property sheet open.
Click on the outer rectangle of the subform, and in the property sheet,
select the data tab.
There you should see Link Master Fields and Link Child Fields. That is what
links the
form and subform to the same record -some ID that you have for the
relationship.
I don't know why you need a lookup box, just display the field that has the
proposed regs in the subform. I am guessing that this is a memo field with a
lot of text?

Damon
 
A

aubrey

The two related fields are already linked.

I need the lookup box b/c there are several Proposed Regs in my subform that
are related to particulars Reg in my "General" main form.

I would like a way to cycle through the Proposed Regs as it relates to the
Reg that I selected on my General form, I would like to do this without
haveing to use the navigation buttons, as it is possible to have upwards of
50 Proposed Regs.

Thanks again,
 
D

Damon Heron

What are the distinct attributes of the 50+ proposed regs that you want to
look for? If it is a string, then include a text box on the mainform that
the user can enter some string.
A command button next to the textbox would be one way of conducting your
search.
So the click event of the command button:

dim strsql as string
strsql = "Select yourtblofProposedRegs.id,
yourtblofProposedRegs.name,yourtblofProposedRegs.whatever, etc from
yourtblofProposedRegs WHERE (((yourtblofProposedRegs.name) Like "*" &
[textbox1] & "*"));"

Me.[yoursubfrm].Form.RecordSource = strsql
Me.[yoursubfrm].Form.Requery

In the above, you would of course have to catch errors like a null textbox.
Damon
 

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