473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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
Nov 13 '05 #1
6 3863
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shanfeng Cheng | last post by:
I write a piece of code to tracking the number of clicks on a link each day. The link usu. gets about 3000-6000 clicks per day. I just store today's click count in a one-line text file, like, ...
3
by: Gary Kahrau | last post by:
How do I programatically apply a click to a particular row and column 0 of a datagrid? I want to do this in code as if the user did a mouse click on the leftmost column. ...
6
by: cefrancke | last post by:
I've read up on Access and the limits of creating visible controls at run-time. I'm using Access 2003 and assume that it cant be done. I did find a clever method of having a main form (and in...
3
by: Robert | last post by:
I have a form with two subforms on it. both subs have the same controlsource. Subform1 is a continuous form that acts as an index. The second subform is a single record that the user will use to...
10
stonward
by: stonward | last post by:
I think this may be my final 'issue' with this project....! I need to add products to a quotation/point of sale form. My products are listed in a listbox on my main form (frmMain) - when I click...
0
by: clarkp73 | last post by:
Hi In VBA I populate an unbound subform (datasheet view) via a recordset that can be changed using filters selected by the user. The only problem I am having is that due to the unbound nature of...
2
by: HSXWillH | last post by:
I'm working in Access 2007 and coming to something that's always caused me problems. I have a form titled frmUsers. There are 3 subforms that list exercise dates and exercise types for each user. ...
1
by: Shona Rennie | last post by:
I have the following in a form: - Main Form which stores EE details - 1st subform - a continuous form with a combo box which allows either selection of an existing contract or option to open...
1
by: neelsfer | last post by:
When i use this code to count the number of records on display in a specific subform in the "txtRecordNo" field that is open now, it seems to "update" all the time as the cursor changes every second...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.