Click Subform To Run Code | | |
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 | | | | re: Click Subform To Run Code
Any reason you can't use a command button?
--
Ken Snell
<MS ACCESS MVP>
"Sally" <smiller@notmyemail.com> wrote in message
news:VsZFd.6987$pZ4.4340@newsread1.news.pas.earthl ink.net...[color=blue]
>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
>
>[/color] | | | | re: Click Subform To Run Code
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]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
news:u9TDeTq#EHA.2568@TK2MSFTNGP11.phx.gbl...[color=blue]
> Any reason you can't use a command button?
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "Sally" <smiller@notmyemail.com> wrote in message
> news:VsZFd.6987$pZ4.4340@newsread1.news.pas.earthl ink.net...[color=green]
> >I need to be able to click in a subform and run code but at the same time[/color][/color]
I[color=blue][color=green]
> > 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[/color][/color]
the[color=blue][color=green]
> > records the code runs. The subform is continuous; all the controls are[/color][/color]
on[color=blue][color=green]
> > 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[/color][/color]
coding[color=blue][color=green]
> > 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
> >
> >[/color]
>
>[/color] | | | | re: Click Subform To Run Code
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" <smiller@notmyemail.com> wrote in message
news:f_%Fd.7760$Ii4.5872@newsread3.news.pas.earthl ink.net...[color=blue]
> 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]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> news:u9TDeTq#EHA.2568@TK2MSFTNGP11.phx.gbl...[color=green]
>> Any reason you can't use a command button?
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Sally" <smiller@notmyemail.com> wrote in message
>> news:VsZFd.6987$pZ4.4340@newsread1.news.pas.earthl ink.net...[color=darkred]
>> >I need to be able to click in a subform and run code but at the same
>> >time[/color][/color]
> I[color=green][color=darkred]
>> > 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[/color][/color]
> the[color=green][color=darkred]
>> > records the code runs. The subform is continuous; all the controls are[/color][/color]
> on[color=green][color=darkred]
>> > 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[/color][/color]
> coding[color=green][color=darkred]
>> > 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
>> >
>> >[/color]
>>
>>[/color]
>
>[/color] | | | | re: Click Subform To Run Code
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]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
news:#nQlKzr#EHA.4072@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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[/color]
selector[color=blue]
> (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[/color]
different[color=blue]
> 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" <smiller@notmyemail.com> wrote in message
> news:f_%Fd.7760$Ii4.5872@newsread3.news.pas.earthl ink.net...[color=green]
> > 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[/color][/color]
value[color=blue][color=green]
> > that is specific to that subform.
> >
> > Sally
> >
> > "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> > news:u9TDeTq#EHA.2568@TK2MSFTNGP11.phx.gbl...[color=darkred]
> >> Any reason you can't use a command button?
> >>
> >> --
> >>
> >> Ken Snell
> >> <MS ACCESS MVP>
> >>
> >> "Sally" <smiller@notmyemail.com> wrote in message
> >> news:VsZFd.6987$pZ4.4340@newsread1.news.pas.earthl ink.net...
> >> >I need to be able to click in a subform and run code but at the same
> >> >time[/color]
> > I[color=darkred]
> >> > need to be able to scroll the records without running the code. I[/color][/color][/color]
tried[color=blue][color=green][color=darkred]
> >> > coding the Enter event of the subform control but when I try to[/color][/color][/color]
scroll[color=blue][color=green]
> > the[color=darkred]
> >> > records the code runs. The subform is continuous; all the controls[/color][/color][/color]
are[color=blue][color=green]
> > on[color=darkred]
> >> > 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[/color]
> > coding[color=darkred]
> >> > 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.[/color][/color][/color]
I'm[color=blue][color=green][color=darkred]
> >> > looking for suggestions!
> >> >
> >> > Thanks,
> >> >
> >> > Sally
> >> >
> >> >
> >>
> >>[/color]
> >
> >[/color]
>
>[/color] | | | | re: Click Subform To Run Code
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" <smiller@notmyemail.com> wrote in message
news:%o4Gd.7338$pZ4.1321@newsread1.news.pas.earthl ink.net...[color=blue]
> 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]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> news:#nQlKzr#EHA.4072@TK2MSFTNGP10.phx.gbl...[color=green]
>> 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[/color]
> selector[color=green]
>> (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[/color]
> different[color=green]
>> 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" <smiller@notmyemail.com> wrote in message
>> news:f_%Fd.7760$Ii4.5872@newsread3.news.pas.earthl ink.net...[color=darkred]
>> > 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[/color][/color]
> value[color=green][color=darkred]
>> > that is specific to that subform.
>> >
>> > Sally
>> >
>> > "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
>> > news:u9TDeTq#EHA.2568@TK2MSFTNGP11.phx.gbl...
>> >> Any reason you can't use a command button?
>> >>
>> >> --
>> >>
>> >> Ken Snell
>> >> <MS ACCESS MVP>
>> >>
>> >> "Sally" <smiller@notmyemail.com> wrote in message
>> >> news:VsZFd.6987$pZ4.4340@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[/color][/color]
> tried[color=green][color=darkred]
>> >> > coding the Enter event of the subform control but when I try to[/color][/color]
> scroll[color=green][color=darkred]
>> > the
>> >> > records the code runs. The subform is continuous; all the controls[/color][/color]
> are[color=green][color=darkred]
>> > 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.[/color][/color]
> I'm[color=green][color=darkred]
>> >> > looking for suggestions!
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Sally
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >[/color]
>>
>>[/color]
>
>[/color] | | | | re: Click Subform To Run Code
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]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
news:#nNGjlz#EHA.2104@TK2MSFTNGP14.phx.gbl...[color=blue]
> 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[/color]
"extra"[color=blue]
> 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" <smiller@notmyemail.com> wrote in message
> news:%o4Gd.7338$pZ4.1321@newsread1.news.pas.earthl ink.net...[color=green]
> > 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[/color][/color]
in[color=blue][color=green]
> > any subform and click in the area below the last record; I will be off[/color][/color]
the[color=blue][color=green]
> > 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[/color][/color]
of[color=blue][color=green]
> > 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[/color][/color]
calendar.[color=blue][color=green]
> >
> > Sally
> >
> >
> > "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> > news:#nQlKzr#EHA.4072@TK2MSFTNGP10.phx.gbl...[color=darkred]
> >> You're saying there is no room for a command button on the subforms[/color][/color][/color]
then?[color=blue][color=green][color=darkred]
> >>
> >> The "click" event for a form occurs only if you click on the record[/color]
> > selector[color=darkred]
> >> (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[/color]
> > different[color=darkred]
> >> approach.
> >>
> >> Are the subforms' values/textboxes just for display? If you don't let[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >> 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" <smiller@notmyemail.com> wrote in message
> >> news:f_%Fd.7760$Ii4.5872@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[/color]
> > value[color=darkred]
> >> > that is specific to that subform.
> >> >
> >> > Sally
> >> >
> >> > "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> >> > news:u9TDeTq#EHA.2568@TK2MSFTNGP11.phx.gbl...
> >> >> Any reason you can't use a command button?
> >> >>
> >> >> --
> >> >>
> >> >> Ken Snell
> >> >> <MS ACCESS MVP>
> >> >>
> >> >> "Sally" <smiller@notmyemail.com> wrote in message
> >> >> news:VsZFd.6987$pZ4.4340@newsread1.news.pas.earthl ink.net...
> >> >> >I need to be able to click in a subform and run code but at the[/color][/color][/color]
same[color=blue][color=green][color=darkred]
> >> >> >time
> >> > I
> >> >> > need to be able to scroll the records without running the code. I[/color]
> > tried[color=darkred]
> >> >> > coding the Enter event of the subform control but when I try to[/color]
> > scroll[color=darkred]
> >> > the
> >> >> > records the code runs. The subform is continuous; all the controls[/color]
> > are[color=darkred]
> >> > 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[/color][/color][/color]
tried[color=blue][color=green][color=darkred]
> >> > coding
> >> >> > the Enter event of the controls and that worked when I clicked on[/color][/color][/color]
a[color=blue][color=green][color=darkred]
> >> >> > 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[/color][/color][/color]
record.[color=blue][color=green]
> > I'm[color=darkred]
> >> >> > looking for suggestions!
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Sally
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>[/color]
> >
> >[/color]
>
>[/color] |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|