Automatic drop-down selection?

  • Follow


Hi Everyone, maybe you can help me out on something...

I have a table on contacts that also have a form to go with it, to add new
ones or look over the old ones.
I have another seperate form which I would like to link to the contact but
dont know how to do it.

What I want to do is to have a button on the contact form that once I click
will automatically select the name on the next form for me, so for example....


I add a new contact - name address etc I click the button, the next form will
open and the name I just added will be automatically selected in the drop-
down box I have on the next form.

So I guess I just want the drop-down to pick up on the name from the other
form and select it automatically.

Can anyone help?

Thank You  and Happy Easter!

-- 
Message posted via http://www.accessmonster.com

0
Reply evilcowstare 4/8/2007 6:50:21 PM

If the form from which you want to select is a continuous form, that is, 
showing multiple records, I'd suggest you use the Click or Double-Click 
event.  In that event code, you'll use the DoCmd.OpenForm statement, with a 
WHERE condition. As a start, in a module window, put the cursor in the 
DoCmd.OpenForm statement and read the Help.

The following (air) code might be a start, assuming the contact Records have 
a key of Contact ID that is a Long Integer (could be AutoNumber), and that 
ContactID is displayed in a TextBox called txtID, and that the next form is 
called frmNext:

   Dim strWhere as String

   strWhere = "ContactID = " & Me.txtID
   DoCmd.OpenForm "frmNext",,,strWhere

If your ContactID is text, the line setting the strWhere would read:

   strWhere = "ContactID = """ & Me.txtID & """"

Yes, the multiple double-quotes are necessary, if that is a Text Field.

I'm not at all certain what you have in mind regarding your comment 
"drop-down to pick up on the name". The above code would open the frmNext to 
the proper Record without any drop-down (Combo Box) control.

  Larry Linson
  Microsoft Access MVP



"evilcowstare via AccessMonster.com" <u31650@uwe> wrote in message 
news:70688f45553ea@uwe...
> Hi Everyone, maybe you can help me out on something...
>
> I have a table on contacts that also have a form to go with it, to add new
> ones or look over the old ones.
> I have another seperate form which I would like to link to the contact but
> dont know how to do it.
>
> What I want to do is to have a button on the contact form that once I 
> click
> will automatically select the name on the next form for me, so for 
> example....
>
>
> I add a new contact - name address etc I click the button, the next form 
> will
> open and the name I just added will be automatically selected in the drop-
> down box I have on the next form.
>
> So I guess I just want the drop-down to pick up on the name from the other
> form and select it automatically.
>
> Can anyone help?
>
> Thank You  and Happy Easter!
>
> -- 
> Message posted via http://www.accessmonster.com
> 


0
Reply Larry 4/9/2007 4:55:46 AM


1 Replies
385 Views

(page loaded in 0.426 seconds)

Similiar Articles:
















7/15/2012 9:08:39 AM


Reply: