Command Button

G

Guest

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"
 
G

Guest

I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

Ofer said:
try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

rfrench said:
How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

rfrench said:
I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

Ofer said:
try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

rfrench said:
How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

So far, I have the Command Button opening the subform ("Open Form"), then
opening the new form (this is where the problem is - form name to open is
"Transaction Detail") and then closing the subform. It is doing everything
correctly, except that is goes to the first record, not the selected record.

Under 'Open Form' for the new form, I have:
Form Name: Transaction Detail
View: Form
Where Condition: [Forms]![TransTable Query Subform]![Exchange
No]=[TransTable]![Exchange No]
Data Mode: Edit
Window Mode: Normal.
(There is nothing under "Filter Name").

Thanks very much!

Ofer said:
post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

rfrench said:
I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

Ofer said:
try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

:

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

I hope I'll get it right
docmd.OpenForm "Transaction Detail",,,"[Exchange No]= '" & me.[Exchange No]
& "'"


rfrench said:
So far, I have the Command Button opening the subform ("Open Form"), then
opening the new form (this is where the problem is - form name to open is
"Transaction Detail") and then closing the subform. It is doing everything
correctly, except that is goes to the first record, not the selected record.

Under 'Open Form' for the new form, I have:
Form Name: Transaction Detail
View: Form
Where Condition: [Forms]![TransTable Query Subform]![Exchange
No]=[TransTable]![Exchange No]
Data Mode: Edit
Window Mode: Normal.
(There is nothing under "Filter Name").

Thanks very much!

Ofer said:
post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

rfrench said:
I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

:

try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

:

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

It's saying it can't parse the expression. I typed it in exactly and have
checked it several times.

I need to type "docmd.OpenForm, even though I am in the Open Form action?


Ofer said:
I hope I'll get it right
docmd.OpenForm "Transaction Detail",,,"[Exchange No]= '" & me.[Exchange No]
& "'"


rfrench said:
So far, I have the Command Button opening the subform ("Open Form"), then
opening the new form (this is where the problem is - form name to open is
"Transaction Detail") and then closing the subform. It is doing everything
correctly, except that is goes to the first record, not the selected record.

Under 'Open Form' for the new form, I have:
Form Name: Transaction Detail
View: Form
Where Condition: [Forms]![TransTable Query Subform]![Exchange
No]=[TransTable]![Exchange No]
Data Mode: Edit
Window Mode: Normal.
(There is nothing under "Filter Name").

Thanks very much!

Ofer said:
post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

:

I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

:

try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

:

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

if its a small mdb, compact it, you can send it to
(e-mail address removed)

I'll take a look, we probably missing something simple

rfrench said:
It's saying it can't parse the expression. I typed it in exactly and have
checked it several times.

I need to type "docmd.OpenForm, even though I am in the Open Form action?


Ofer said:
I hope I'll get it right
docmd.OpenForm "Transaction Detail",,,"[Exchange No]= '" & me.[Exchange No]
& "'"


rfrench said:
So far, I have the Command Button opening the subform ("Open Form"), then
opening the new form (this is where the problem is - form name to open is
"Transaction Detail") and then closing the subform. It is doing everything
correctly, except that is goes to the first record, not the selected record.

Under 'Open Form' for the new form, I have:
Form Name: Transaction Detail
View: Form
Where Condition: [Forms]![TransTable Query Subform]![Exchange
No]=[TransTable]![Exchange No]
Data Mode: Edit
Window Mode: Normal.
(There is nothing under "Filter Name").

Thanks very much!

:

post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

:

I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

:

try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

:

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 
G

Guest

I will work on it and try to send it to you if I still have problems. Thanks.

Ofer said:
if its a small mdb, compact it, you can send it to
(e-mail address removed)

I'll take a look, we probably missing something simple

rfrench said:
It's saying it can't parse the expression. I typed it in exactly and have
checked it several times.

I need to type "docmd.OpenForm, even though I am in the Open Form action?


Ofer said:
I hope I'll get it right
docmd.OpenForm "Transaction Detail",,,"[Exchange No]= '" & me.[Exchange No]
& "'"


:

So far, I have the Command Button opening the subform ("Open Form"), then
opening the new form (this is where the problem is - form name to open is
"Transaction Detail") and then closing the subform. It is doing everything
correctly, except that is goes to the first record, not the selected record.

Under 'Open Form' for the new form, I have:
Form Name: Transaction Detail
View: Form
Where Condition: [Forms]![TransTable Query Subform]![Exchange
No]=[TransTable]![Exchange No]
Data Mode: Edit
Window Mode: Normal.
(There is nothing under "Filter Name").

Thanks very much!

:

post the code you wrote, the name of the field in the form you want to use as
the filter, the name of the form, the name of the field in the table that the
second form is bounded to.

me stand for the form Im currently working with

:

I so want this to work, but it does not. The field type is a string, by the
way. I tried this suggestion with several variations, but to no avail. What
does the "me" portion of the phrase do?

:

try that, enter the where condition in the open command
' If the field type is number
docmd.OpenForm "FormName",,,"[FieldNameInTable]= " & me.filednameinform

' If the field type is string
docmd.OpenForm "FormName",,,"[FieldNameInTable]= '" & me.filednameinform & "'"

' If the field type is date
docmd.OpenForm "FormName",,,"[FieldNameInTable]= #" & me.filednameinform & "#"

:

How do I create a command button in a form (#1) that will open a different
form (#2) of a selected record on a subform within form #1? (I understand
how to instruct it to open the form, but I don't understand what the Action
Command is that tells it to go to the SELECTED record). (The subform has
multiple records, which are shown in Datasheet View. I want it to go to the
form of the one I have clicked on). Thanks.
 

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