Macro or Command

R

Randy

I need some assistance in created either a macro or command. I have a form
(Classes) that contains information about particular classes including "class
name" and "class date". I have created another form (Class Search) with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class shown on the
"Class Search" form (from the selection list) and have it go directly to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
S

Steve Schapel

Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.
 
R

Randy

Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes form but
goes to the first record rather than going to the record I double clicked on
in the selection form. It seems that no matter where I click on my selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


Steve Schapel said:
Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP

I need some assistance in created either a macro or command. I have a form
(Classes) that contains information about particular classes including "class
name" and "class date". I have created another form (Class Search) with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class shown on the
"Class Search" form (from the selection list) and have it go directly to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
T

tina

both of Steve's solutions will return a recordset with only the pertinent
record in it. sounds like your form is opening with multiple records. which
solution did you use? and how did you set it up?


Randy said:
Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes form but
goes to the first record rather than going to the record I double clicked on
in the selection form. It seems that no matter where I click on my selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


Steve Schapel said:
Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP

I need some assistance in created either a macro or command. I have a form
(Classes) that contains information about particular classes including "class
name" and "class date". I have created another form (Class Search) with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class shown on the
"Class Search" form (from the selection list) and have it go directly to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
R

Randy

Hi Tina...Thank you for your response. I have actually tried both methods. If
I use the formula within the OpenForm macro I get the first record always, no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get a blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


tina said:
both of Steve's solutions will return a recordset with only the pertinent
record in it. sounds like your form is opening with multiple records. which
solution did you use? and how did you set it up?


Randy said:
Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes form but
goes to the first record rather than going to the record I double clicked on
in the selection form. It seems that no matter where I click on my selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


Steve Schapel said:
Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I have a form
(Classes) that contains information about particular classes including "class
name" and "class date". I have created another form (Class Search) with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class shown on the
"Class Search" form (from the selection list) and have it go directly to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
T

tina

btw, hi, neighbor! <g>

okay, we need some basic info. are the selection list and the Classes list
based on the same table? what's the name of the primary key field?

is the selection list a listbox or combo box on the ClassSearch form? if so,
what's the name of the control?

post the code from your test of the "formula within the OpenForm macro."


Randy said:
Hi Tina...Thank you for your response. I have actually tried both methods. If
I use the formula within the OpenForm macro I get the first record always, no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get a blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


tina said:
both of Steve's solutions will return a recordset with only the pertinent
record in it. sounds like your form is opening with multiple records. which
solution did you use? and how did you set it up?


Randy said:
Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes form but
goes to the first record rather than going to the record I double
clicked
on
in the selection form. It seems that no matter where I click on my selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


:

Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I
have a
form
(Classes) that contains information about particular classes
including
"class
name" and "class date". I have created another form (Class Search) with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class
shown
on the
"Class Search" form (from the selection list) and have it go
directly
to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
R

Randy

neighbor? Where ya from? Yes the Selection List (listbox) and the Classes
Form are based on the same table (Classes). The primary key is ClassID.
The Selection List (Class Selection) is a Listbox within the Class Selection
Form. There is no name in the control. Should there be?

Here is the code within the OpenForm Macro under the "where condition":
[ClassID]=[Forms]![Class Selection Form]![ClassID]


--
Randy Street
Rancho Cucamonga, CA


tina said:
btw, hi, neighbor! <g>

okay, we need some basic info. are the selection list and the Classes list
based on the same table? what's the name of the primary key field?

is the selection list a listbox or combo box on the ClassSearch form? if so,
what's the name of the control?

post the code from your test of the "formula within the OpenForm macro."


Randy said:
Hi Tina...Thank you for your response. I have actually tried both methods. If
I use the formula within the OpenForm macro I get the first record always, no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get a blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


tina said:
both of Steve's solutions will return a recordset with only the pertinent
record in it. sounds like your form is opening with multiple records. which
solution did you use? and how did you set it up?


Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes form but
goes to the first record rather than going to the record I double clicked
on
in the selection form. It seems that no matter where I click on my
selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


:

Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So in the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and enter the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes form.
In that case, all you need for your macro on the double-click event on
the control on the Class Search form is an OpenForm action with no Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I have a
form
(Classes) that contains information about particular classes including
"class
name" and "class date". I have created another form (Class Search)
with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class shown
on the
"Class Search" form (from the selection list) and have it go directly
to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
T

tina

my first guess is that you're using the wrong control name in the macro's
Where clause. open the ClassSelectionForm in design view. click once on the
listbox control to select it. open the Properties box, and click on the
Other tab. look at the Name property. that's the name of your listbox. (the
default bound column of a listbox is 1, so unless you changed it, the first
column of the listbox's RowSource is the bound column. that means the the
first column should be ClassID; note: it doesn't matter whether the column
is "hidden" in the listbox in form view.)

so your expression in the macro's Where clause should be
[ClassID]=[Forms]![Class Selection Form]![MyListboxControlName]

substituting the correct control name that you found on the Other tab, as
directed above.

if it still doesn't work for you, post back and we'll get it fixed.

hth
(btw, Riverside)


Randy said:
neighbor? Where ya from? Yes the Selection List (listbox) and the Classes
Form are based on the same table (Classes). The primary key is ClassID.
The Selection List (Class Selection) is a Listbox within the Class Selection
Form. There is no name in the control. Should there be?

Here is the code within the OpenForm Macro under the "where condition":
[ClassID]=[Forms]![Class Selection Form]![ClassID]


--
Randy Street
Rancho Cucamonga, CA


tina said:
btw, hi, neighbor! <g>

okay, we need some basic info. are the selection list and the Classes list
based on the same table? what's the name of the primary key field?

is the selection list a listbox or combo box on the ClassSearch form? if so,
what's the name of the control?

post the code from your test of the "formula within the OpenForm macro."


Randy said:
Hi Tina...Thank you for your response. I have actually tried both
methods.
If
I use the formula within the OpenForm macro I get the first record
always,
no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get a blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


:

both of Steve's solutions will return a recordset with only the pertinent
record in it. sounds like your form is opening with multiple
records.
which
solution did you use? and how did you set it up?


Steve...Thank you for your assistance. Everything seems to work ok except
when I double click on my selection list it does oprn the classes
form
but
goes to the first record rather than going to the record I double clicked
on
in the selection form. It seems that no matter where I click on my
selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


:

Randy,

You can use an OpenForm macro for this. I assume you have a prinmary
key field for your Classes such as a ClassID or some such? So
in
the
Where Condition argument of the OpenForm macro action, put the equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form will
stay open, is to make a query based on your Classes table, and
enter
the
equivalent of this in the criteria of the ClassID column in the query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the
Classes
form.
In that case, all you need for your macro on the double-click
event
on
the control on the Class Search form is an OpenForm action with
no
Where
Condition required. Or if the Classes form is already open, you could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I have a
form
(Classes) that contains information about particular classes including
"class
name" and "class date". I have created another form (Class Search)
with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular
class
shown
on the
"Class Search" form (from the selection list) and have it go directly
to that
record within the "Classes" form containing all the class information.

Can anyone help? Any assistance would be greatly appreaciated.
 
R

Randy

Tina I have one word to describe you.....AWESOME!! Thank you so much. I had
tried that but for some reason still wasn't working. Guess you have the magic
touch! If I knew where in Riverside you were I would send you bunches and
bunches of flowers!
Thanks so much for your help. Have a super wonderful fantastic day!
--
Randy Street
Rancho Cucamonga, CA


tina said:
my first guess is that you're using the wrong control name in the macro's
Where clause. open the ClassSelectionForm in design view. click once on the
listbox control to select it. open the Properties box, and click on the
Other tab. look at the Name property. that's the name of your listbox. (the
default bound column of a listbox is 1, so unless you changed it, the first
column of the listbox's RowSource is the bound column. that means the the
first column should be ClassID; note: it doesn't matter whether the column
is "hidden" in the listbox in form view.)

so your expression in the macro's Where clause should be
[ClassID]=[Forms]![Class Selection Form]![MyListboxControlName]

substituting the correct control name that you found on the Other tab, as
directed above.

if it still doesn't work for you, post back and we'll get it fixed.

hth
(btw, Riverside)


Randy said:
neighbor? Where ya from? Yes the Selection List (listbox) and the Classes
Form are based on the same table (Classes). The primary key is ClassID.
The Selection List (Class Selection) is a Listbox within the Class Selection
Form. There is no name in the control. Should there be?

Here is the code within the OpenForm Macro under the "where condition":
[ClassID]=[Forms]![Class Selection Form]![ClassID]


--
Randy Street
Rancho Cucamonga, CA


tina said:
btw, hi, neighbor! <g>

okay, we need some basic info. are the selection list and the Classes list
based on the same table? what's the name of the primary key field?

is the selection list a listbox or combo box on the ClassSearch form? if so,
what's the name of the control?

post the code from your test of the "formula within the OpenForm macro."


Hi Tina...Thank you for your response. I have actually tried both methods.
If
I use the formula within the OpenForm macro I get the first record always,
no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get a blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


:

both of Steve's solutions will return a recordset with only the
pertinent
record in it. sounds like your form is opening with multiple records.
which
solution did you use? and how did you set it up?


Steve...Thank you for your assistance. Everything seems to work ok
except
when I double click on my selection list it does oprn the classes form
but
goes to the first record rather than going to the record I double
clicked
on
in the selection form. It seems that no matter where I click on my
selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


:

Randy,

You can use an OpenForm macro for this. I assume you have a
prinmary
key field for your Classes such as a ClassID or some such? So in
the
Where Condition argument of the OpenForm macro action, put the
equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form
will
stay open, is to make a query based on your Classes table, and enter
the
equivalent of this in the criteria of the ClassID column in the
query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes
form.
In that case, all you need for your macro on the double-click event
on
the control on the Class Search form is an OpenForm action with no
Where
Condition required. Or if the Classes form is already open, you
could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I
have a
form
(Classes) that contains information about particular classes
including
"class
name" and "class date". I have created another form (Class Search)
with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class
shown
on the
"Class Search" form (from the selection list) and have it go
directly
to that
record within the "Classes" form containing all the class
information.

Can anyone help? Any assistance would be greatly appreaciated.
 
T

tina

you're very welcome! :)


Randy said:
Tina I have one word to describe you.....AWESOME!! Thank you so much. I had
tried that but for some reason still wasn't working. Guess you have the magic
touch! If I knew where in Riverside you were I would send you bunches and
bunches of flowers!
Thanks so much for your help. Have a super wonderful fantastic day!
--
Randy Street
Rancho Cucamonga, CA


tina said:
my first guess is that you're using the wrong control name in the macro's
Where clause. open the ClassSelectionForm in design view. click once on the
listbox control to select it. open the Properties box, and click on the
Other tab. look at the Name property. that's the name of your listbox. (the
default bound column of a listbox is 1, so unless you changed it, the first
column of the listbox's RowSource is the bound column. that means the the
first column should be ClassID; note: it doesn't matter whether the column
is "hidden" in the listbox in form view.)

so your expression in the macro's Where clause should be
[ClassID]=[Forms]![Class Selection Form]![MyListboxControlName]

substituting the correct control name that you found on the Other tab, as
directed above.

if it still doesn't work for you, post back and we'll get it fixed.

hth
(btw, Riverside)


Randy said:
neighbor? Where ya from? Yes the Selection List (listbox) and the Classes
Form are based on the same table (Classes). The primary key is ClassID.
The Selection List (Class Selection) is a Listbox within the Class Selection
Form. There is no name in the control. Should there be?

Here is the code within the OpenForm Macro under the "where condition":
[ClassID]=[Forms]![Class Selection Form]![ClassID]


--
Randy Street
Rancho Cucamonga, CA


:

btw, hi, neighbor! <g>

okay, we need some basic info. are the selection list and the
Classes
list
based on the same table? what's the name of the primary key field?

is the selection list a listbox or combo box on the ClassSearch
form? if
so,
what's the name of the control?

post the code from your test of the "formula within the OpenForm macro."


Hi Tina...Thank you for your response. I have actually tried both methods.
If
I use the formula within the OpenForm macro I get the first record always,
no
matter which record I double click on in my selection list.

If I use the query method with the formula within the query I get
a
blank
record when double clicking a record on the selection list.

I am stumped!
--
Randy Street
Rancho Cucamonga, CA


:

both of Steve's solutions will return a recordset with only the
pertinent
record in it. sounds like your form is opening with multiple records.
which
solution did you use? and how did you set it up?


Steve...Thank you for your assistance. Everything seems to work ok
except
when I double click on my selection list it does oprn the
classes
form
but
goes to the first record rather than going to the record I double
clicked
on
in the selection form. It seems that no matter where I click on my
selection
list, it goes to the first record. Any suggestions?
--
Randy Street
Rancho Cucamonga, CA


:

Randy,

You can use an OpenForm macro for this. I assume you have a
prinmary
key field for your Classes such as a ClassID or some such?
So
in
the
Where Condition argument of the OpenForm macro action, put the
equivalnt
of this...
[ClassID]=[Forms]![Class Search]![ClassID]

Another way to achieve this, assuming that the Class Search form
will
stay open, is to make a query based on your Classes table,
and
enter
the
equivalent of this in the criteria of the ClassID column in the
query...
[Forms]![Class Search]![ClassID]
.... and then use this query as the Record Source for the Classes
form.
In that case, all you need for your macro on the
double-click
event
on
the control on the Class Search form is an OpenForm action
with
no
Where
Condition required. Or if the Classes form is already open, you
could
use a macro with a SelectObject action.

--
Steve Schapel, Microsoft Access MVP


Randy wrote:
I need some assistance in created either a macro or command. I
have a
form
(Classes) that contains information about particular classes
including
"class
name" and "class date". I have created another form (Class Search)
with a
selection list that shows all the classes with their dates.

What I need is to be able to double-click on a particular class
shown
on the
"Class Search" form (from the selection list) and have it go
directly
to that
record within the "Classes" form containing all the class
information.

Can anyone help? Any assistance would be greatly appreaciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top