Command Button "Find"

T

Terressa

Hi I have a database that I created a Main Menu to go to my forms, but when I
open the form from my Main Menu my "Find" command button on my form brings up
a dialog box that states "The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find" command button
works fine. I don't understand. Can someone help me?

Thanks,
Terressa
 
A

Allen Browne

What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a field.
 
T

Terressa

Allen,
I just posted a reply, but I don't know if it got through.

Please just send me directions on how to do this.

Thank you so much,
Terressa
 
T

Terressa

Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa
 
A

Allen Browne

Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terressa said:
Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


Allen Browne said:
What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.
 
T

Terressa

Allen,
Thanks for helping me.

My form is bound to more than one table. It is a split form that has member
information on top (first name, last name, phone...) and a subform on the
bottom that has member's contributions that is bound to a table and/or query.

When I open my church membership database the Main Menu pops up first that
has command buttons on it that goes to my forms/reports.

When I exit out of my Main Menu and open my "Members/Contributions" form
from my Navigation Bar the "Find" button works perfectly, no problems. It is
just when I open "Members/Contributions form from my Main Menu that it will
not work and states "command button is not available".

Thanks,
Terressa


Allen Browne said:
Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terressa said:
Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


Allen Browne said:
What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.



Hi I have a database that I created a Main Menu to go to my forms,
but when I open the form from my Main Menu my "Find" command
button on my form brings up a dialog box that states
"The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find" command
button works fine. I don't understand. Can someone help me?
 
A

Allen Browne

Is it a popup?

Did adding the RunCommand help?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
Terressa said:
Allen,
Thanks for helping me.

My form is bound to more than one table. It is a split form that has
member
information on top (first name, last name, phone...) and a subform on the
bottom that has member's contributions that is bound to a table and/or
query.

When I open my church membership database the Main Menu pops up first that
has command buttons on it that goes to my forms/reports.

When I exit out of my Main Menu and open my "Members/Contributions" form
from my Navigation Bar the "Find" button works perfectly, no problems. It
is
just when I open "Members/Contributions form from my Main Menu that it
will
not work and states "command button is not available".

Thanks,
Terressa


Allen Browne said:
Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be
saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terressa said:
Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


:

What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.



Hi I have a database that I created a Main Menu to go to my forms,
but when I open the form from my Main Menu my "Find" command
button on my form brings up a dialog box that states
"The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find" command
button works fine. I don't understand. Can someone help me?
 
T

Terressa

Yes it is a popup.
No the RunCommand didn't help.
--
Terressa


Allen Browne said:
Is it a popup?

Did adding the RunCommand help?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
Terressa said:
Allen,
Thanks for helping me.

My form is bound to more than one table. It is a split form that has
member
information on top (first name, last name, phone...) and a subform on the
bottom that has member's contributions that is bound to a table and/or
query.

When I open my church membership database the Main Menu pops up first that
has command buttons on it that goes to my forms/reports.

When I exit out of my Main Menu and open my "Members/Contributions" form
from my Navigation Bar the "Find" button works perfectly, no problems. It
is
just when I open "Members/Contributions form from my Main Menu that it
will
not work and states "command button is not available".

Thanks,
Terressa


Allen Browne said:
Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be
saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


:

What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.



Hi I have a database that I created a Main Menu to go to my forms,
but when I open the form from my Main Menu my "Find" command
button on my form brings up a dialog box that states
"The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find" command
button works fine. I don't understand. Can someone help me?
 
A

Allen Browne

So, your choices are:
a) to not use a popup form, or
b) to not use the built-in Find.

If the form needs to be a popup, you could code your own find. Use FindFirst
on the RecordsetClone of the form, and then match bookmarks.

The ribbon is in the main Access window. The popup form is not. The popup
form therefore can't get to the ribbon.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terressa said:
Yes it is a popup.
No the RunCommand didn't help.
--
Terressa


Allen Browne said:
Is it a popup?

Did adding the RunCommand help?

Terressa said:
Allen,
Thanks for helping me.

My form is bound to more than one table. It is a split form that has
member
information on top (first name, last name, phone...) and a subform on
the
bottom that has member's contributions that is bound to a table and/or
query.

When I open my church membership database the Main Menu pops up first
that
has command buttons on it that goes to my forms/reports.

When I exit out of my Main Menu and open my "Members/Contributions"
form
from my Navigation Bar the "Find" button works perfectly, no problems.
It
is
just when I open "Members/Contributions form from my Main Menu that it
will
not work and states "command button is not available".

Thanks,
Terressa


:

Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be
saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or
query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


:

What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.



Hi I have a database that I created a Main Menu to go to my
forms,
but when I open the form from my Main Menu my "Find" command
button on my form brings up a dialog box that states
"The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find"
command
button works fine. I don't understand. Can someone help me?
 
T

Terressa

Thank you so much for all of your help. On the 2007 Version there is a
"Search" on the bottom of each form where they can find members there. This
will be good enough.

Sincerely,
Terressa


Allen Browne said:
So, your choices are:
a) to not use a popup form, or
b) to not use the built-in Find.

If the form needs to be a popup, you could code your own find. Use FindFirst
on the RecordsetClone of the form, and then match bookmarks.

The ribbon is in the main Access window. The popup form is not. The popup
form therefore can't get to the ribbon.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terressa said:
Yes it is a popup.
No the RunCommand didn't help.
--
Terressa


Allen Browne said:
Is it a popup?

Did adding the RunCommand help?

Allen,
Thanks for helping me.

My form is bound to more than one table. It is a split form that has
member
information on top (first name, last name, phone...) and a subform on
the
bottom that has member's contributions that is bound to a table and/or
query.

When I open my church membership database the Main Menu pops up first
that
has command buttons on it that goes to my forms/reports.

When I exit out of my Main Menu and open my "Members/Contributions"
form
from my Navigation Bar the "Find" button works perfectly, no problems.
It
is
just when I open "Members/Contributions form from my Main Menu that it
will
not work and states "command button is not available".

Thanks,
Terressa


:

Okay, perhaps this is an embedded macro in Access 2007.

The On Click property of the button is the right one.
GoToControl handles the Screen.PreviousControl for you.
The error handing for that is good.

Perhaps you could insert a line above all the others that does:
RunCommand SaveRecord
That should give you an error message if the current record can't be
saved
for any reason (in which case you can't go to a new record

Can we confirm that this is a form that is bound to some table or
query?

Is it a popup form (i.e. you can move it outside the Access window)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Allen,
I'm new to posting can you tell? :)

I went to view code on find button and there was no code.
My "on click" stated this:
OnError Next
GoToControl =[Screen].[PreviousControl].[Name]
ClearMacroError
RunCommand Find
[MacroError]<>0 MsgBox =[MacroError].[Description], Yes, None

This is a form that has church members (first name, last name, etc.)

How do you set focus to ScreenPreviousControl?

Sincerely,
Terressa


:

What's in the code behind your command button?
And what event did you use? On Click?

Is this a bound form? (If not, there's nothing to find.)

Did you SetFocus to Screen.PreviousControl?
When the button's code runs, it has focus, and it is not bound to a
field.



Hi I have a database that I created a Main Menu to go to my
forms,
but when I open the form from my Main Menu my "Find" command
button on my form brings up a dialog box that states
"The command or action isn't available now".

If I open this same form from the Navigation Bar the "Find"
command
button works fine. I don't understand. Can someone help me?
 

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