Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201

    Unanswered: Form Moving Within Window

    Hello again, Colleagues All!
    I have a silly little cosmetic problem in Access (2000 up to 2003) which annoys me because I like everything to look just so for my clients (vanity, vanity - all is vanity!).
    The application is a Front-of-House application recording bookings for a function caterer. The start-up program is a sort of switchboard where existing clients are identified and needs identified (a booking or merely an enquiry. The Booking or Enquiry form is opened and the switchboard closed. After the booking is recorded, that form is closed and the switchboard reopened. The registration within the window is perfect (all forms are maximised).
    The booking form contains a lot of lists of courses, dishes, staff, extras, hire-items and so forth. The data is displayed in listboxes which are locked, but respond to the double-click by opening another form dedicated to editing that particular list. In that form, items are selected from a list of those available and copied into the corresponding list specific to the booking. When finished, the editor is closed and control returns to the booking.
    Note that the booking form was not closed, because it is somewhat slow to start up due to the number of requeries needed for a lot of the listboxes, combo boxes and such like. When we return to the booking form, however, it seems to have slipped down the screen a bit. The header with the caption (normally hidden behind a menu bar) is visible and some control buttons at the bottom are now out of site. The form was declared without scroll-bars, but these have mysteriously appeared (they are a function of the window no doubt) and it is possible to move the form back up to give access to the control buttons. However, as one clicks outside the cursor on the scrollbar (page movement) it moves too far up, so that data at the top of the form is no longer visible! Using the cursor gives lesser movement, but it is not possible to get exactly the registration that it started with.
    I have tried messing about with modal and pop-up behaviour but nothing works. Has any of you enormously bright people out there got an explanation for this phenomenon and suggestions on how to make the form stay in place ?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    scrollbars appear if the current size of the form is insufficient layout of the form (ie you have something on your form which is beyond the current visible area.

    what you could do is put some code behind the main booking forms on activate, and or on got focus event (I think) which calls the maximise macro. I'm not on a PC whch has Access on at present so I can be certain. but I think you need to cal the macro
    docmd forms.maximise
    or it could be just (no docmd)
    me.maximise

    thatr will get round your problem

    I suspect what is happening is that as you switch between forms Access is no longer maximising the form and sets the forms position as if it were a cascading MDI display (multiple document interface). Personally Im not a fan of maximising forms, And Im not a fan of dictating to the user how they use my systems.. becuase in reality its 'their' system not mine

    HTH
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201
    Thanks for your input HTH (or do you prefer Healdem ?). I am not using the activate() function because, before closing, the editor runs a series of requeries on the lists in the booking form before closing. This causes control to wag between the two forms, so that they show up in alternation - very confusing for my (somewhat naive) users. However, I did like you use of the GotFocus() function for the form itself (this is more usually applied to indivdual fields) and gave it a try - all to no avail.
    Actually, the form remains the same size. It has simply slipped down the Access window a bit. The scrollbars are in the Access window, not the form itself. It appears that when first opened, the form's top LH corner datum is located below its title bar (which is then hidden behind the Access menu), but when it returns, the datum has moved to the top of the form's title bar, so that it is exposed. I can scroll it back under the menu again so that it looks broadly like it used to, except that the one-line step is not quite modular with the height of the title bar, so it all looks a bit untitdy.
    I used the documenter in the Database Utilities menu to dump the properties of the Bookings form and there are some co-ordinates for something called a Window, where the Left co-ordinate is -600, though this does not seem to affect the form which is correctly registered left-to-right.
    As that great American actor Yul Brynner said thousands of times in his all-too-short life "Is a puzzlement!"

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    does turning off screen repaints help?

    On Error GoTo err_mySubroutine
    Application.Echo False
    'do
    'your
    'stuff
    'here
    exit_mySubroutine:
    On Error Resume Next
    Application.Echo True
    Exit Sub
    err_mySubroutine:
    MsgBox Err.Number & ": " & Err.Description, vbExclamation, "Error in mySubroutine"
    Resume exit_mySubroutine

    since you are running stuff in several forms, plan your error handling carefully to guarantee that echo is back on again when the dust settles no matter where an error is thrown.

    .Echo also has a statusbar parameter if you like the statusbar.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Jim Wright
    Thanks for your input HTH (or do you prefer Healdem ?)
    erm actually HTH is Hope That Helps
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You can also try the restore command - ie.
    Forms!MyForm.setfocus
    docmd.restore
    or
    Forms!MyForm.setfocus
    docmd.movesize xxx,xxx,xxx,xxx (read the help on this.)

    I was a bit concerned though reading that you had to keep the form open due to the slowness of the form opening and requerying. I've rarely had to keep a form open because it was slow requerying listboxes/comboboxes (or other things happening) on opening and I wonder if you're not trying to requery some listboxes/comboboxes unnecessarily or if there might not be a better way to do what you're doing. But I'd need to see the form to make some suggestions (if you want to upload it, I'd be more than happy to take a look and make some suggestions.) It's a little concerning when I read that a form has to stay open all the time (mainly because this can cause other issues, especially performance and data integrity issues - and is not the best approach for a multi-user, client-server mdb. For example - opening a form based on a recordset, keeping it open all the time, and then opening other forms based on that same recordset can cause issues if not setup correctly.) (My guess is code in the other forms opening with this form staying open is affecting this form in some way.)

    One suggestion without seeing the form is to look at the property of the query(s) in the listbox(s)/combobox(s) and change the Recordset Types from Dynaset to Snapshot (this sometimes help with the speed of the query executing.) - since you're not updating anything in the query(s), a snapshot can be used for the listboxes/comboboxes. Another suggestion is don't requery the listboxes upon opening but instead set the rowsource of the listbox/combobox to the sql statement (and use criteria to set it to a limited number of records which match some ID or other criteria on the form versus trying to requery the entire recordset for each listbox/combobox.) Requerying a lot of listboxes/comboboxes on the entire recordset will cause the form to open slowly and using criteria very often significantly cuts down the query slowness which will then lead to a faster opening/performing form.)

    Like healdem, I'm also not a fan of opening forms maximized and instead prefer opening forms as modals and popups. This way I can control users from opening multiple forms which could conflict with a form already open (and I like to prevent the user from doing other things/accessing certain menus that you can do with a maximized form.) But I also use the FormInfo module (see next paragraph) which I've found to work very nicely.

    Lastly, there is a Form Manipulation example in the code bank which utilizes the FormInfo module (by Sybex). Using this module, you can tweak the form to do things you normally can't do and make it look better. Here's the link: http://www.dbforums.com/showpost.php...9&postcount=51
    I use the FormInfo in almost every application and have and found it to be a very nice way to make my forms look and do what I want them to do (and error free). In the example, there are many, many ways to make the form look like almost anything (ie. remove the caption bar, make it fade in/out, etc...) and the example is worth taking a glance at (you can use any code in the example to import into your application and the code is pretty simple).

    Otherwise if you can't upload the mdb, what code is executing in the OnOpen/OnLoad event of the form. If you can post any code you have running when the form opens, some suggestions can probably be made to make your form load more efficiently and faster (I've always used 3 seconds as a maximum time for any form loading).
    Last edited by pkstormy; 05-18-08 at 22:48.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201
    Hello again, Colleagues all!
    First, to Healdem. Sorry about the little gaffe, but you must remember that some of us were born before texting became a primary school subject ! Has anybody produced a dictionary of these acronyms ? I have just about mastered BTW !
    Next, to izyrider. The repaint suppression sounds like a nice idea to experiment with. However, I will have to think about exactly where to position the code.
    Finally, to pkstormy. Thanks very much for your wideranging response. Actually, the parent form requeries only refer to the current booking and the selections of dishes etc. are subtables of the parent table. Actually, when mounted on the client's Windows 2003 server, the responses are quite a bit quicker than on my own very cluttered PC. The general architecture is that the parent used to contain a lot of subforms on a number of pages and rows in the subforms where selected from listboxes. As the model got more and more elaborate, I moved the listboxes to dedicated editors so that the complex rules of selection could be encapsulated. Then I went back to the parent form and replaced the subforms with locked listboxes, where the only accepted command was a double-click which opened the appropriate editor. All of the listboxes and/or subforms only select subrecords of the parent record. Everything possible is run from lookup tables edited in another Back-of-House application.
    If time permits, I will try and put together a little .mdb file with the relevant tables and code to show how the overall model works. Most of my 40 years experience has been with enterprise systems such as Informix and Oracle. However, my current clientele are all Access users and one is never too old to learn new tricks.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Jim Wright
    Hello again, Colleagues all!
    First, to Healdem. Sorry about the little gaffe, but you must remember that some of us were born before texting became a primary school subject ! Has anybody produced a dictionary of these acronyms ? I have just about mastered BTW!
    nae bother, you are not the first to confuse HTH as a sign off or initials...

    and like you I was born & kicked out of University long before "textspeak" became the only language of the yoof of today, well apart from grunting that is

    and in case you are in need of a dictionary.. try t'net. heres one
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •