473,503 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Move subform with horizontal scroll bar

reginaldmerritt
201 New Member
Hi

I use a subform on a mainform as a type of menu selection. I want to keep the subform in the middle of the screen when the mainform horizontal scroll bar is moved.

Is there an event on the horizontal scroll bar I can use?

What method is used to move a subform on a main form?

Thanks
Jul 30 '12 #1
18 7813
twinnyfo
3,653 Recognized Expert Moderator Specialist
reginaldmerritt,

One possible sollution, would be to actually make your main form a subform on another form. Then place your original subform on that new master form as well. The original master form, now a subform, could scroll to the left or right in its own right, and the original subform, now a subform on a different master form, would be stationary.

You would have to tweak all the master/child relationships for data to make sure that all the forms were linked together, but it might be the easiest way to solve, rather than trying to code figuring out exactly how far a form has moved, then moving the subform.

Let me know if you make any headway on this....
Jul 30 '12 #2
reginaldmerritt
201 New Member
Thanks twinnyfo that's a good suggestion.

The main form is a continuous multi record form. If I make the mainform a subform the vertical scroll bar would be set within the subform; and this doesn't display well when viewing the database on a workstation with a large display. but nice suggestion though, thanks.
Jul 30 '12 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
I don't know what type of data you have, that requires such a wide record view.... Is there a reason you couldn't put one entire record in a view? Even if you made a reasonably wide, tall view for the entire record, it might help. But, based on your description, I understand your desire to be able to move that subform.

Still thinking about this one.........
Jul 30 '12 #4
reginaldmerritt
201 New Member
I managed to create a public subroutine to move any control. You use it in the following manner

Call MoveControl(amount to move left, amount to move top, amount to move width, amount to move height,name of control)

In my case i just want to move the subform left acording to the user scrolling.

Expand|Select|Wrap|Line Numbers
  1. Call MoveControl(40,0,0,0,"MenuSubform")
Expand|Select|Wrap|Line Numbers
  1. Public Sub MoveControl(lngLeft As Long, lngTop As Long, lngWidth As Long, lngHeight As Long, ContolName As String)
  2. Dim lngCL, lngCT, lngCW, lngCH As Long
  3.  
  4. lngCL = Controls(ContolName).Left
  5. lngCT = Controls(ContolName).top
  6. lngCW = Controls(ContolName).width
  7. lngCH = Controls(ContolName).height
  8.  
  9. With Controls(ContolName)
  10.     Call .Move(lngCL + lngLeft, lngCT + lngTop, lngCW + lngWidth, lngCH + lngHeight)
  11. End With
  12. End Sub
  13.  
  14.  
Aug 8 '12 #5
reginaldmerritt
201 New Member
Problem is I still haven't found a property that changes as the user scrolls. If anyone has any ideas they would be very much appreciated.

Many Thanks
Aug 8 '12 #6
twinnyfo
3,653 Recognized Expert Moderator Specialist
Innovative solution. But, just out of curiosity, how do you know how far to move the particular control?, especially since it is related to a scroll bar. Is there a way to gauge what percentage the scroll bar has travelled?

This migh thave some useful applications--especially in situations like yours......
Aug 8 '12 #7
reginaldmerritt
201 New Member
I can not identify how much the scroll bar has moved as I can not find property that relates to this.
Aug 8 '12 #8
reginaldmerritt
201 New Member
Shame that there isn't an OnScroll event or a property that changes when the scroll bar is moved. Would be great if there was a property that showed how much the scroll bar has moved or the scroll bar current location.

Perhaps there is a way of moving a control to a certain pixel location. Perhaps doing this on a timer event would be a good work around this.

However, I've decided to fix this issue in another way. Rereading what 'twinnyfo' put in a previous post I decided to display the data differently by putting the records on another subform. This way the scrolling would only effect the subform and not the main form or the other subform I was having issues with.

So haven't actually solved the problem of moving a subform or any control based on the scroll bar but this fix will be sufficient for now. If anyone does have a way of moving controls based on scroll bar position I would be very much interested.

twinnyfo thanks for your help with this.
Aug 8 '12 #9
twinnyfo
3,653 Recognized Expert Moderator Specialist
Reginald,

I have been trying to track down this scrollbar thing, too. Apparently there IS a stand-alone scrollbar object in Access (somewhere) and MS provides all this information all over the place about how to gather data from it........ But nowhere does it tell us how to put this control on our forms!

Oh, well. I'm glad I could provide a plausible, if not desired, option for your form. If I track this scrollbar thing down, I will repost....
Aug 8 '12 #10
twinnyfo
3,653 Recognized Expert Moderator Specialist
MS Excel..... but not for Access apparently...

I guess you could "make" a scrollbar in your form, that would just move a small box along a continuum using scroll buttons.....
Aug 8 '12 #11
zmbd
5,501 Recognized Expert Moderator Expert
"stand-alone scrollbar object in Access"
Poor choice of names by MS for this control. It is also found in Excel as a "form control" that you can place on a worksheet… as to why it’s not directly available in Access… once again the genius of Microsoft.

This is NOT a windows Scroll-bar.

This is a slider type control along the same lines as the spinner-buttons (think slider volume control or dimmer switch etc.) http://msdn.microsoft.com/en-us/libr.../gg278467.aspx

To get this control on an access form… insert an active-x



- This control is only vertical from what I can tell...
- Getting the events to fire for it within Access is a hit and miss. Works great in excel; however, I prefer the spinner buttons... which brings us to:
- There are a lot easier controls for users to use.

And... there you go.

-z
Attached Images
File Type: jpg slidercontrol.jpg (70.6 KB, 3419 views)
Aug 8 '12 #12
twinnyfo
3,653 Recognized Expert Moderator Specialist
Thanks, z! I knew there had to be some way to use it....
Aug 8 '12 #13
reginaldmerritt
201 New Member
Thanks, I knew there had to be some Activex control, i'm sure there has to be a horizontal control out there somewhere too.
Aug 9 '12 #14
twinnyfo
3,653 Recognized Expert Moderator Specialist
Reginald,

Just resize the control so that it is wider than it is tall and it becomes a horizontal scrollbar.....
Aug 9 '12 #15
zmbd
5,501 Recognized Expert Moderator Expert
the one I've shown doesn't work that way... it only goes top to bottom... making wider only makes the button wider.

there is no horizontal standalone that I can find.

unless there is a windows api call there's not much more to add.

-z
Aug 9 '12 #16
twinnyfo
3,653 Recognized Expert Moderator Specialist
I'm using Access 2007, same ActiveX Control.....
Attached Images
File Type: jpg Scrollbar.jpg (77.7 KB, 750 views)
Aug 9 '12 #17
zmbd
5,501 Recognized Expert Moderator Expert
Very interesting...
when I tried it, that did not happen... the control simply became wider!
I'll have to give it w whirl again and see if I can get it to do the same thing!
-z
Aug 9 '12 #18
zmbd
5,501 Recognized Expert Moderator Expert
Well...
Worked on my Office-PC just as twinnyfo suggested.
I would then think that one could use the on-enter/got-focus events to pull the control's current value. Depending on the complexity of the form you might then use the Updateevent to do a smooth scoll using the idea by reginaldmerritt in post #5 or use the on-exit/lost-focus event to get the control's updated value to do a final "snap" to...

-z
(now why didn't that work at home? same program, same revision level... Look, that rabbit's got a vicious streak a mile wide! It's a killer! )
Aug 9 '12 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2874
by: Nishant | last post by:
I have a combo box with a horizontal scroll bar. (Used SetHorizontalExtent) The dropdown with horizontal scroll bar works fine when I have more items in the dropdown list. However when the...
2
7502
by: Boaz Ben-Porat | last post by:
Hi all Is there a way to simulate a click on a scrollbar (horizontal) of a FataGrid ? I need to programmatically scroll the grid to the right/left upon some condition, when the total width of...
2
4391
by: Tina | last post by:
Am I missing something or does the listbox web control not have a horizontal scroll capability? Thanks, T
2
5017
by: Sam | last post by:
I've researched and tried all the suggestions I've found and still haven't been able to get the horizontal scroll bar to appear in my combo box. I've tried setting the Column Widths property...
3
3968
by: ApexData | last post by:
I have created a SearchForm which is basically a PopUp Continuous Form that displays 15 Fields. Each field is displayed as a column and when the user clicks on any record or row, the form closes...
5
10153
by: RobertK | last post by:
I have a table that displays one row of images (thumbnails). When a user clicks on an image it opens up a bigger image below it. The row has about 20 cells. I have a <divtag which allows the user...
1
3444
LegalIT
by: LegalIT | last post by:
Hello, I have an application that loads a set of database records into memory. I then have buttons to move to the first, next, previous or last record. I would like to add a horizontal scroll...
1
9089
by: amuven | last post by:
Hi All, I need to put a horizontal scroll bar for 4 cells alone where my first cell in table should not contain any horizontal scroll bar . In clear, let us say there are 5 columns in my...
1
4334
by: newbie009 | last post by:
How can I disable horizontal scroll in textbox for FireFox? Right now 1 textbox has vertical scroll and other textbox has horizontal scroll. It only looks like this on FireFox but it looks ugly....
0
1654
by: shanteshk | last post by:
Hi I have developed ab application in which I fecing an Issue when I browse in Google chrome i.e The Horizontal scroll bar in not appearing in an application when applicatin page size gets wider...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.