Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Creating a command

Geek News

Creating a command
"mugziegumz via AccessMonster.com" <u47747[ at ]uwe> 12/9/2008 8:50:17 PM
Brand new with access-
How can I create a command in datasheet form to open another form? Is this
possible? I tried doing the command in datasheet view/form but it didn't work.


I'd like to create a command next to each person's name. So if I clicked on
their last name in datasheet view-it'd open to a new form with lots more
detail.
Step by step instrucitons please! Where do I put the command in properties?
My table name is "Contact Info" my form name is "Contact Details" which give
a more in depth explanation of each employee such as evaluation comments.
Can someone give me a command and tell me where to put it and how to run it?
Shannon

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: Creating a command
"Graham Mandeno" <Graham.Mandeno[ at ]nomail.please> 12/9/2008 9:46:34 PM
Hi Shannon

The code to open the other form is:

DoCmd.OpenForm "Contact Details", _
WhereCondition:="ContactID=" & Me.ContactID, _
WindowMode:=acDialog

Replace ContactID with the name of your primary key. If your primary key is
a text field then enclose the value in quotes:
WhereCondition:="ContactID='" & Me.ContactID & "'", _

The WindowMode:=acDialog bit tells Access not to do anything else until the
form you are opening is either closed or made invisible.

Where you put this code depends on your preference. You could create a
command button and add it to its Click event procedure, or you could perhaps
use the DblClick event of the textbox showing the contact name.

Note that you can make a continuous or tabular form which displays many
records but which is much more flexible and powerful than a datasheet form.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

"mugziegumz via AccessMonster.com" <u47747[ at ]uwe> wrote in message
news:8e6b9f2c2baaf[ at ]uwe...
[Quoted Text]
> Brand new with access-
> How can I create a command in datasheet form to open another form? Is this
> possible? I tried doing the command in datasheet view/form but it didn't
> work.
>
>
> I'd like to create a command next to each person's name. So if I clicked
> on
> their last name in datasheet view-it'd open to a new form with lots more
> detail.
> Step by step instrucitons please! Where do I put the command in
> properties?
> My table name is "Contact Info" my form name is "Contact Details" which
> give
> a more in depth explanation of each employee such as evaluation comments.
> Can someone give me a command and tell me where to put it and how to run
> it?
> Shannon
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1
>


Re: Creating a command
"mugziegumz via AccessMonster.com" <u47747[ at ]uwe> 12/10/2008 1:50:06 PM
I don't have a primary key because I had to allow duplicates....can I still
use this command? Where do I put the command? In properties under Macro
Builder, Expression Builder or Code builder? Once I enter this code in....
then what do I do?
As said below- I'm brand new.
Shannon

Graham Mandeno wrote:
[Quoted Text]
>Hi Shannon
>
>The code to open the other form is:
>
>DoCmd.OpenForm "Contact Details", _
> WhereCondition:="ContactID=" & Me.ContactID, _
> WindowMode:=acDialog
>
>Replace ContactID with the name of your primary key. If your primary key is
>a text field then enclose the value in quotes:
> WhereCondition:="ContactID='" & Me.ContactID & "'", _
>
>The WindowMode:=acDialog bit tells Access not to do anything else until the
>form you are opening is either closed or made invisible.
>
>Where you put this code depends on your preference. You could create a
>command button and add it to its Click event procedure, or you could perhaps
>use the DblClick event of the textbox showing the contact name.
>
>Note that you can make a continuous or tabular form which displays many
>records but which is much more flexible and powerful than a datasheet form.
>> Brand new with access-
>> How can I create a command in datasheet form to open another form? Is this
>[quoted text clipped - 13 lines]
>> it?
>> Shannon

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

Re: Creating a command
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/10/2008 5:52:04 PM
On Wed, 10 Dec 2008 13:50:06 GMT, "mugziegumz via AccessMonster.com"
<u47747[ at ]uwe> wrote:

[Quoted Text]
>I don't have a primary key because I had to allow duplicates...

EVERY table *must* have a primary key, otherwise it's not a table, just a
heap.

Stop. Step back. If your table of Clients has multiple records for each
client, your database design is *wrong* and will give you endless trouble!

What's the structure of your table? What information does it contain?
--

John W. Vinson [MVP]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net