By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Click Subform To Run Code

P: n/a
I need to be able to click in a subform and run code but at the same time I
need to be able to scroll the records without running the code. I tried
coding the Enter event of the subform control but when I try to scroll the
records the code runs. The subform is continuous; all the controls are on
one line and the detail section is not exsposed above or below the controls.
I tried coding the detail Click event but nothing happened. I tried coding
the Enter event of the controls and that worked when I clicked on a control.
The problem with that though is that the code doesn't execute when there are
no records or when I click in the white area after the last record. I'm
looking for suggestions!

Thanks,

Sally
Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Any reason you can't use a command button?

--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:Vs*****************@newsread1.news.pas.earthl ink.net...
I need to be able to click in a subform and run code but at the same time I
need to be able to scroll the records without running the code. I tried
coding the Enter event of the subform control but when I try to scroll the
records the code runs. The subform is continuous; all the controls are on
one line and the detail section is not exsposed above or below the
controls.
I tried coding the detail Click event but nothing happened. I tried coding
the Enter event of the controls and that worked when I clicked on a
control.
The problem with that though is that the code doesn't execute when there
are
no records or when I click in the white area after the last record. I'm
looking for suggestions!

Thanks,

Sally

Nov 13 '05 #2

P: n/a
Thanks for responding, Ken,

Yes, there are forty two small subforms on the main form and the code needs
to know which one was clicked on. Clicking on any subform returns a value
that is specific to that subform.

Sally

"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
Any reason you can't use a command button?

--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:Vs*****************@newsread1.news.pas.earthl ink.net...
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried
coding the Enter event of the subform control but when I try to scroll the records the code runs. The subform is continuous; all the controls are on one line and the detail section is not exsposed above or below the
controls.
I tried coding the detail Click event but nothing happened. I tried coding the Enter event of the controls and that worked when I clicked on a
control.
The problem with that though is that the code doesn't execute when there
are
no records or when I click in the white area after the last record. I'm
looking for suggestions!

Thanks,

Sally


Nov 13 '05 #3

P: n/a
You're saying there is no room for a command button on the subforms then?

The "click" event for a form occurs only if you click on the record selector
(if it's visible). And from your description, if you don't want to code
click events of every control on the subforms, then you'll need a different
approach.

Are the subforms' values/textboxes just for display? If you don't let the
user edit them, then you could put a single, transparent command button
across and on top of all the controls in a subform; and then use the click
event of that button to run your code.

--

Ken Snell
<MS ACCESS MVP>
"Sally" <sm*****@notmyemail.com> wrote in message
news:f_*****************@newsread3.news.pas.earthl ink.net...
Thanks for responding, Ken,

Yes, there are forty two small subforms on the main form and the code
needs
to know which one was clicked on. Clicking on any subform returns a value
that is specific to that subform.

Sally

"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
Any reason you can't use a command button?

--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:Vs*****************@newsread1.news.pas.earthl ink.net...
>I need to be able to click in a subform and run code but at the same
>time I > need to be able to scroll the records without running the code. I tried
> coding the Enter event of the subform control but when I try to scroll the > records the code runs. The subform is continuous; all the controls are on > one line and the detail section is not exsposed above or below the
> controls.
> I tried coding the detail Click event but nothing happened. I tried coding > the Enter event of the controls and that worked when I clicked on a
> control.
> The problem with that though is that the code doesn't execute when
> there
> are
> no records or when I click in the white area after the last record. I'm
> looking for suggestions!
>
> Thanks,
>
> Sally
>
>



Nov 13 '05 #4

P: n/a
Yes, there is no room for a command button.
Yes, the textboxes on the subforms are only for display.

If I go with the command button, what happens when I scroll the records in
any subform and click in the area below the last record; I will be off the
command button? This is the reason for my post before this one. I am asking
if there is a way to code a click event for that area. That problem is
extenuated because there will only be one command button and hense most of
the area in the subform will not be covered by a command button.

Also, Allow Additions is set to False in the subforms.

To picture what I have better, the subforms are arranged like a calendar.

Sally
"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:#n**************@TK2MSFTNGP10.phx.gbl...
You're saying there is no room for a command button on the subforms then?

The "click" event for a form occurs only if you click on the record selector (if it's visible). And from your description, if you don't want to code
click events of every control on the subforms, then you'll need a different approach.

Are the subforms' values/textboxes just for display? If you don't let the
user edit them, then you could put a single, transparent command button
across and on top of all the controls in a subform; and then use the click
event of that button to run your code.

--

Ken Snell
<MS ACCESS MVP>
"Sally" <sm*****@notmyemail.com> wrote in message
news:f_*****************@newsread3.news.pas.earthl ink.net...
Thanks for responding, Ken,

Yes, there are forty two small subforms on the main form and the code
needs
to know which one was clicked on. Clicking on any subform returns a value that is specific to that subform.

Sally

"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
Any reason you can't use a command button?

--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:Vs*****************@newsread1.news.pas.earthl ink.net...
>I need to be able to click in a subform and run code but at the same
>time

I
> need to be able to scroll the records without running the code. I tried > coding the Enter event of the subform control but when I try to scroll
the
> records the code runs. The subform is continuous; all the controls
are on
> one line and the detail section is not exsposed above or below the
> controls.
> I tried coding the detail Click event but nothing happened. I tried

coding
> the Enter event of the controls and that worked when I clicked on a
> control.
> The problem with that though is that the code doesn't execute when
> there
> are
> no records or when I click in the white area after the last record.

I'm > looking for suggestions!
>
> Thanks,
>
> Sally
>
>



Nov 13 '05 #5

P: n/a
What I suggest is that you put the command button across the entire detail
section of the subform. That way, the button is available for all the
displayed records.

Because you have the subform set to not allow additions, there is no "extra"
record at the bottom, so there will not be a command button there. I don't
know what the "white space" is at the bottom of your subform...is the
subform's form footer?
--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:%o*****************@newsread1.news.pas.earthl ink.net...
Yes, there is no room for a command button.
Yes, the textboxes on the subforms are only for display.

If I go with the command button, what happens when I scroll the records in
any subform and click in the area below the last record; I will be off the
command button? This is the reason for my post before this one. I am
asking
if there is a way to code a click event for that area. That problem is
extenuated because there will only be one command button and hense most of
the area in the subform will not be covered by a command button.

Also, Allow Additions is set to False in the subforms.

To picture what I have better, the subforms are arranged like a calendar.

Sally
"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:#n**************@TK2MSFTNGP10.phx.gbl...
You're saying there is no room for a command button on the subforms then?

The "click" event for a form occurs only if you click on the record

selector
(if it's visible). And from your description, if you don't want to code
click events of every control on the subforms, then you'll need a

different
approach.

Are the subforms' values/textboxes just for display? If you don't let the
user edit them, then you could put a single, transparent command button
across and on top of all the controls in a subform; and then use the
click
event of that button to run your code.

--

Ken Snell
<MS ACCESS MVP>
"Sally" <sm*****@notmyemail.com> wrote in message
news:f_*****************@newsread3.news.pas.earthl ink.net...
> Thanks for responding, Ken,
>
> Yes, there are forty two small subforms on the main form and the code
> needs
> to know which one was clicked on. Clicking on any subform returns a value > that is specific to that subform.
>
> Sally
>
> "Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
> news:u9**************@TK2MSFTNGP11.phx.gbl...
>> Any reason you can't use a command button?
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Sally" <sm*****@notmyemail.com> wrote in message
>> news:Vs*****************@newsread1.news.pas.earthl ink.net...
>> >I need to be able to click in a subform and run code but at the same
>> >time
> I
>> > need to be able to scroll the records without running the code. I tried >> > coding the Enter event of the subform control but when I try to scroll > the
>> > records the code runs. The subform is continuous; all the controls are > on
>> > one line and the detail section is not exsposed above or below the
>> > controls.
>> > I tried coding the detail Click event but nothing happened. I tried
> coding
>> > the Enter event of the controls and that worked when I clicked on a
>> > control.
>> > The problem with that though is that the code doesn't execute when
>> > there
>> > are
>> > no records or when I click in the white area after the last record. I'm >> > looking for suggestions!
>> >
>> > Thanks,
>> >
>> > Sally
>> >
>> >
>>
>>
>
>



Nov 13 '05 #6

P: n/a
Ken,

Thanks for staying with me on this! I found the solution. See my last post
in my previos thread Subform "White Areas".

Sally
"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:#n**************@TK2MSFTNGP14.phx.gbl...
What I suggest is that you put the command button across the entire detail
section of the subform. That way, the button is available for all the
displayed records.

Because you have the subform set to not allow additions, there is no "extra" record at the bottom, so there will not be a command button there. I don't
know what the "white space" is at the bottom of your subform...is the
subform's form footer?
--

Ken Snell
<MS ACCESS MVP>

"Sally" <sm*****@notmyemail.com> wrote in message
news:%o*****************@newsread1.news.pas.earthl ink.net...
Yes, there is no room for a command button.
Yes, the textboxes on the subforms are only for display.

If I go with the command button, what happens when I scroll the records in any subform and click in the area below the last record; I will be off the command button? This is the reason for my post before this one. I am
asking
if there is a way to code a click event for that area. That problem is
extenuated because there will only be one command button and hense most of the area in the subform will not be covered by a command button.

Also, Allow Additions is set to False in the subforms.

To picture what I have better, the subforms are arranged like a calendar.
Sally
"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:#n**************@TK2MSFTNGP10.phx.gbl...
You're saying there is no room for a command button on the subforms then?
The "click" event for a form occurs only if you click on the record

selector
(if it's visible). And from your description, if you don't want to code
click events of every control on the subforms, then you'll need a

different
approach.

Are the subforms' values/textboxes just for display? If you don't let the user edit them, then you could put a single, transparent command button
across and on top of all the controls in a subform; and then use the
click
event of that button to run your code.

--

Ken Snell
<MS ACCESS MVP>
"Sally" <sm*****@notmyemail.com> wrote in message
news:f_*****************@newsread3.news.pas.earthl ink.net...
> Thanks for responding, Ken,
>
> Yes, there are forty two small subforms on the main form and the code
> needs
> to know which one was clicked on. Clicking on any subform returns a

value
> that is specific to that subform.
>
> Sally
>
> "Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
> news:u9**************@TK2MSFTNGP11.phx.gbl...
>> Any reason you can't use a command button?
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Sally" <sm*****@notmyemail.com> wrote in message
>> news:Vs*****************@newsread1.news.pas.earthl ink.net...
>> >I need to be able to click in a subform and run code but at the same >> >time
> I
>> > need to be able to scroll the records without running the code. I

tried
>> > coding the Enter event of the subform control but when I try to

scroll
> the
>> > records the code runs. The subform is continuous; all the controls

are
> on
>> > one line and the detail section is not exsposed above or below the
>> > controls.
>> > I tried coding the detail Click event but nothing happened. I tried > coding
>> > the Enter event of the controls and that worked when I clicked on a >> > control.
>> > The problem with that though is that the code doesn't execute when
>> > there
>> > are
>> > no records or when I click in the white area after the last
record. I'm
>> > looking for suggestions!
>> >
>> > Thanks,
>> >
>> > Sally
>> >
>> >
>>
>>
>
>



Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.