Go To Record Question

  • Thread starter Thread starter sowen12
  • Start date Start date
S

sowen12

I have a form (Contacts) where I do all of my data entry. I want to
create a Switchboard to quickly access reports and perform various
functions.

I want to have a Go To Record function on the Switchboard. When I
select the account from the combo box, it would take me to that
particular record on the Contacts form.

I know how to do this with a combo box on the Contacts form, but how
do I do it from a different form?

Thanks!
Scott
 
Hi,

Here is some simple code you use with a combo box.

Private Sub cbomycomboboxname_AfterUpdate()
Dim strCbo As Long
strCbo = Me!cbomycomboboxname

DoCmd.OpenForm "myformname"
Forms!MembersForm![mycontrolID].SetFocus
DoCmd.FindRecord (strCbo)

End Sub

I this example, mycontrolID is the control on the other form that displays
the Primary Key Field's value.

I love this little snippet of code--it works great!

Hunter57
Just huntin' for some data.
http://churchmanagementsoftware.googlepages.com
 
Oops, I left my old formname in that last bit of code. Hope this is better.

Private Sub cbomycomboboxname_AfterUpdate()

Dim strCbo As Long
strCbo = Me!cbomycomboboxname

DoCmd.OpenForm "myotherformname"
Forms!myotherformname![myPrimaryKeyIDcontrolname].SetFocus
DoCmd.FindRecord (strCbo)
End Sub

Note that this code requires that your Primary Key Field is a number.

Hunter57
 
Back
Top