button on form to search a table to open another form..

R

Rebecca

I have a form that opens when you do a search for a certain firm, on the
form is the firm name and a subform that list all the members in this firm
in datasheet form, starting with the autonumber(memberid, which is the
primary key).
What I want/need is if someone is interested in seeing a certain members
information they can enter that memberid into a box on the current form
click on a button and it opens the member form. How would I go about
getting this? I thought about making a subform but what I need is some sort
of lookup box or something.

Would it be easier to have a button next to each memberid that said "open
member record", but how would I do that?

I've been playing with different macros and forms today but my brain is not
working.. well actually everything I have tried isn't working..

Thanks in advance!!

Rebecca S.
 
P

Pavel Romashkin

I think that the best way of doing this (I learned that people would
rather click than type) is to allow the user to select the member by
clicking on his record in the subform, then press a button on the main
form to open the Members form for that member or double click the
member's name in the subform.
Fisrt off, is the subfrm with members list locked? If so it will not
allow to select a member by clicking.
Let's say you can click and select a member. You have options - you can
make a command button (obvious to the user) or you could use a mouse
double click (not so obvious to most except those extremely impatient
who click twice on everything, so you might want to include a tool tip
for the Member name text box).
But the code is very much the same:

for the Click event of a command button on the main form:
DoCmd.OpenForm "Members Form", , , "MemberID = " & Me.SubformControlName.Form!MemberID

for the double click of the member name on the subform:
DoCmd.OpenForm "Members Form", , , "MemberID = " & Me!MemberID

And don't blame that brain. It needs a break sometimes, too :)
Hope this helps,
Pavel
 
R

Rebecca

I have been out ill for the past week at work and just received your
response. Thank you.

I believe this would work perfectly, having them click on the name and then
hit a command button that opens up the member's file in a form. But I do
not know/write/ (to be honestly, understand) SQL. I work primarily in the
design view. Where and how would I use the codes you provided?

Rebecca S.
 

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