Computer Learning Zone CLZ Access Excel Word Windows

People who boast about their I.Q. are losers.

-Stephen Hawking
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Form Positioning    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Open Form at Cursor
Sandra Truax 
         
12 months ago
Hey Richard, don't you want to make and addendum to this so that it will open the form at the cursor? I've been trying (with the help of ChatGPT) for hours and cannot get it to work.  I'm trying to use it with your pop-up calendar.
Richard Rost  @Reply  
          
12 months ago
I don't understand what you mean by "open the form at the cursor." Can you elaborate? Screen shot maybe?
Sandra Truax OP  @Reply  
         
12 months ago

Sandra Truax OP  @Reply  
         
12 months ago
If I click on the EvenDate on the left, I would love if the calendar would open on at the point where I clicked, so if it is a cont. form it would still open at the point I clicked, even if it was at the bottom. Also, the NoteDate at the right (yellow), if I click there, it would be great if the calendar would open there instead of the other side of the screen. I use this on multiple forms, and I tried getting the x,y coordinates and moving or opening the form at those coordinates, but nothing works.
Sami Shamma  @Reply  
             
12 months ago
Hi Sandra

The Calendar Form Is Model and Popup, correct?
Access has a problem where you cannot control were it opens. On my system with 3 Monitors, it is always on the wrong monitor.
Sami Shamma  @Reply  
             
12 months ago
I think it is on the list of items we are compiling for the Access team.
Richard Rost  @Reply  
          
12 months ago
Yeah, this is definitely a tricky situation. The easy solution is to not make it pop up, just make it modal. This way it opens up on top of other windows, and you have to select the value and close it before you can interact with anything behind it. That's basically what you want to do with this mini form anyways. You want to pick a date, close it, and then it returns the date.

Actual popup windows are useful when you want to interact with them, but also still interact with the windows behind them. So you could popup something up like a notepad form, keep that off to the side, and yet still be able to interact with your customer form. But the notepad popup remains on top of other forms. That's okay, but popup windows break the boundaries of the Access application interface, which is why they're difficult to track. I've got a two-monitor setup myself, and popup windows appear anywhere. I try not to use popup windows if possible, and I only use modal windows because it's very difficult to position them.

I know I played around with this in the past, and there is code in the code vault to open forms at a particular location (Open Form Right, for example). Maybe I'll play around with this and see if I can get it so it opens near the cursor or the mouse pointer. The mouse pointer is a pain because you have to use special tricks to figure out where the pointer is. I'll add it to my list. In the meantime, just get rid of Popup and keep it modal. It will stay at least within your Access application window.
Sandra Truax OP  @Reply  
         
12 months ago
I had already turned off the Popup. My next attempt is to assign a number to a tempvars and use if elseif to move it to coordinates depending on the code. Have no idea if that will work either, but I'm like a dog with a bone, and can't let it go.
Richard Rost  @Reply  
          
12 months ago
You're over-thinking it. Just move the modal form to the location of the button. Let's say you've got two spots where you open up the modal form from: your order button and maybe if you click on your customer ID. In the click events for those two objects, just move your modal form to where that object exists.

DetailsPrivate Sub CustomerID_Click()

    DoCmd.OpenForm "ModalF"
    DoCmd.MoveSize CustomerID.Left, CustomerID.Top
    
End Sub

Private Sub OrderBtn_Click()

    DoCmd.OpenForm "ModalF"
    DoCmd.MoveSize OrderBtn.Left, OrderBtn.Top
    
End Sub


Easy peasy lemon squeezy. This would make a nice little video. Thanks for the tip, lol.

MoveSize
Richard Rost  @Reply  
          
12 months ago

Sandra Truax OP  @Reply  
         
12 months ago
I'm sad to say, this didn't work either. The two fields are in two different subforms. Could that be the reason why? Or is it something I'm doing wrong?
Sandra Truax OP  @Reply  
         
12 months ago
When I used this technique on a single form, it worked perfect. But all my forms have the date fields in subforms.
Richard Rost  @Reply  
          
12 months ago
Yeah, with a subform, it's going to be a little more complicated.

DetailsPrivate Sub ProductName_Click()

    Dim X As Long, Y As Long
        
    X = Forms!OrderF.WindowLeft + Forms!OrderF!OrderDetailF.Left + ProductName.Left
    Y = Forms!OrderF.WindowTop + Forms!OrderF!OrderDetailF.Top + ProductName.Top

    DoCmd.OpenForm "ModalF"
    DoCmd.MoveSize X, Y
    
End Sub

Private Sub SumExtPrice_Click()

    Dim X As Long, Y As Long
        
    X = Forms!OrderF.WindowLeft + Forms!OrderF!OrderDetailF.Left + SumExtPrice.Left
    Y = Forms!OrderF.WindowTop + Forms!OrderF!OrderDetailF.Top + SumExtPrice.Top

    DoCmd.OpenForm "ModalF"
    DoCmd.MoveSize X, Y
    
End Sub


I'll try playing around with it a little bit more when I'm done with my taxes today. I'll see if I can figure out if getting the mouse coordinates is the best method, and this will give you good enough if you have an object like I put it on the sum extended price on my order form, and it is close enough with the y coordinate. But it's assuming that you only have one record in the form which is kind of how it works with subforms and continuous subforms. Especially, but yeah I could use a little more tweaking. I'll play with it later.
Sandra Truax OP  @Reply  
         
12 months ago
Yes! I was able to get this to work!!! Thanks!!  I had given up.
Richard Rost  @Reply  
          
12 months ago
Well, your idea gave me a great idea for a video and an extended cut, so thank you!
Sandra Truax OP  @Reply  
         
12 months ago
You're welcome!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Form Positioning.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 3:23:07 PM. PLT: 1s