View Single Post
  #5  
Old June 9th, 2008, 10:00 PM posted to microsoft.public.access.gettingstarted
Klatuu
external usenet poster
 
Posts: 7,074
Default (Easier) Database

Well, VBA is the better way. If you work on learning VBA, you can do a lot
more with it.

To to it without writing any VBA.
To make it simple lets call the first form form1 and the form you want to
open to a specific record form2.

First you will need to know the name of the field that is the primary key
field of the record source for form2. You will need it when you build your
macro.

First we need to create a new macro. In the first line under Action, enter
OpenForm. Some options at the bottom will show up. Put the name of form 2
in Form Name. Now we need to tell it which record we want to show when form
2 opens. That is done in the Where Condition box. This has to be done
correctly. You want to put the name of the field I described previously
followed by an = and a reference to the control on form1 where you have the
value of the field for the record you want to find. For example, let's say
your field name is ClientID and it is in a text box named txtClient on form1
and it is a numeric field. The syntax would be:
[ClientID] = Forms!form1!txtClient

Save the macro and give it a name.

Now, on form1 put a new command button on your form. When you create a new
command button, you will get a command button wizard.

When the wizard launches, select miscellaneous from Categories and Select
Run Macro from Actions.
Click Next
Select the macro you just built from the list.
Click Next.
Now you have the option to either put a text caption or a picture on the
button. Do whatever you want.
Click Next.
Give the command button a name if you want to. (I would give it a name that
tells me what the button does.
Note about names. Don't use spaces or special characters in names. Use
only letters, numbers, and the underscore character. This is not required,
but it is very good practice for a number of reasons.

Click Finish

Now test it. If you put a value found in form2's record source, the form
will open showing that record. If the value doesn't exist, you will get a
new blank record.
--
Dave Hargis, Microsoft Access MVP


"KiwiB" wrote:

My suggestion stemmed from wanting to use a command button to open a form
from another one at the relevant record. I asked some questions and all the
replies suggested I use VBA. I am keen to know an is an easier way.
Thanks

"Klatuu" wrote:

You don't really have to use an VBA programming in Access 2007, but you will
probably need to use some Macros. Access is designed to be able to build
applications without having to use any VBA coding.
--
Dave Hargis, Microsoft Access MVP


"KiwiB" wrote:

We need a programme somewhere between Works Database and Access. ie a simple
relational database that works by wizards without the need for programming
language. It seems 2007 is not so (new) user friendly as was 2003 and needs
programming language at a lower level.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...ttingsta rted