Macro to open a specific record

  • Thread starter Thread starter Lloyd
  • Start date Start date
L

Lloyd

I am an Access novice and am trying to design an
application using primarily macros. I am able to use
forms and buttons to create a decent navigation system.

I would also like to associate a macro with a command
button to prompt the user for a primary key value and then
open a form with that record. I know I can do that with a
query, but would prefer to use a macro function directly
if that is possible.

Any help appreciated, Lloyd
 
You probably won't find much help on here with macros. Seems kinda silly to
create a macro and then tie it to a button on a form. You would end up with
tons of macros.

You should place code behind your button. Assuming there is a field on the
form which contains the primary key, you could do the following...

In the OnClick event, simply enter code similar to...


DoCmd.OpenForm "SomeFormName", , , "[PrimaryKey]=" & Me![PrimaryKey]







I am an Access novice and am trying to design an
application using primarily macros. I am able to use
forms and buttons to create a decent navigation system.

I would also like to associate a macro with a command
button to prompt the user for a primary key value and then
open a form with that record. I know I can do that with a
query, but would prefer to use a macro function directly
if that is possible.

Any help appreciated, Lloyd
 
Back
Top