Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-04-2017, 12:15 PM   #1
gstylianou
Newly Registered User
 
Join Date: Dec 2013
Posts: 194
Thanks: 35
Thanked 4 Times in 4 Posts
gstylianou is on a distinguished road
Open popup form on correct position

Good evening,
I have one form which includes a button to the bottom corner (left). I would like to find a way so that if I press this button I can open a popup form just above this button.

It is important, however, that since If i have a different screen display on my computer, automatically the code to read the position of the button and the form to be open to the right place. Is there any way so to do that?
(I attach a base example)

thanks in advanced
Attached Files
File Type: accdb Example.accdb (392.0 KB, 93 views)

gstylianou is offline   Reply With Quote
Old 11-04-2017, 12:25 PM   #2
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

It can be done by detecting the overall screen size, the screen position of the button and the popup form size but I think it will require some fairly complex code.

I have a different suggestion which will be far easier.
Change your popup form so that it becomes a hidden subform.
Place it where you want it on the main form.

Now change your button code so this makes the new subform visible.
You could also do this so clicking the button again hides the subform.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 11-04-2017, 12:51 PM   #3
gstylianou
Newly Registered User
 
Join Date: Dec 2013
Posts: 194
Thanks: 35
Thanked 4 Times in 4 Posts
gstylianou is on a distinguished road
Re: Open popup form on correct position

Hi and thanks for your info,

Therefore, its not a solution for me to hide the form because i cannot put it into a main form because there are many controls and this is problem...

But, please help me on how can find the screen position of the button if you want... I mean is there a way to read automatically this position and store it in a field?

gstylianou is offline   Reply With Quote
Old 11-04-2017, 01:07 PM   #4
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Quote:
Originally Posted by gstylianou View Post
Hi and thanks for your info,

Therefore, its not a solution for me to hide the form because i cannot put it into a main form because there are many controls and this is problem...

But, please help me on how can find the screen position of the button if you want... I mean is there a way to read automatically this position and store it in a field?
It doesn't matter that you have lots of controls on the form.
The subform can be placed over the top or underneath other controls as its normally invisible. Whilst it will then cover those other controls when visible, so would a popup form.

As I said before, the code to do what you want is complicated.
You can't store the info in a table as it will change with screen size and resolution.
If you really want to do it, do a site search or Google search
Here's a link that may help though I'm sure you'll find others
https://bytes.com/topic/access/answe...sition-control
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
gstylianou (11-05-2017)
Old 11-04-2017, 09:53 PM   #5
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,545
Thanks: 57
Thanked 2,422 Times in 2,322 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Open popup form on correct position

here is your database.
Attached Files
File Type: accdb Example.accdb (992.0 KB, 115 views)
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
gstylianou (11-05-2017)
Old 11-05-2017, 02:01 AM   #6
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Arnel's solution perfectly illustrates what I was trying to say:

The position is hard coded into the form code
So whilst it works perfectly at certain resolutions it gives less than ideal layouts at other resolutions / screen sizes

For example:
a) Perfect at 1680x1050 or 1400x1050 (shown below)



b) Wrongly placed at 800x600 or 1280x720 (shown below)



If differing resolutions aren't an issue then by all means go for it.
Attached Images
File Type: png 1280x720.PNG (14.8 KB, 1043 views)
File Type: png 1400x1050.PNG (18.8 KB, 1028 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 11-05-2017 at 03:43 AM.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
gstylianou (11-05-2017)
Old 11-05-2017, 03:15 AM   #7
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,545
Thanks: 57
Thanked 2,422 Times in 2,322 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Open popup form on correct position

somewhat manageable now
Attached Files
File Type: zip Example.zip (37.4 KB, 48 views)

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
gstylianou (11-05-2017)
Old 11-05-2017, 05:20 AM   #8
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Hi Arnel

Quote:
somewhat manageable now
Not really - I've just tried it at 3 random resolutions with & without the form maximised. In several cases, the popup form covers the button itself.

Two more examples attached e.g.



This isn't intended as a criticism of your code:
Hard coding position values will work on the monitor used when coding and if the form state (restore / maximise) isn't changed.

However as soon as you change the resolution, monitor size or form state, the results are unpredictable,
To solve this, you need to take account of all of these things...

Personally I'd rather do it a different way but that's just me
Attached is a simplified version of what I would do instead using a subform
Attached Images
File Type: png 800x600.PNG (19.1 KB, 56 views)
File Type: png 1680x1050.PNG (21.5 KB, 1114 views)
Attached Files
File Type: accdb Example-CR.accdb (540.0 KB, 79 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
gstylianou (11-05-2017)
Old 11-05-2017, 05:23 AM   #9
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,545
Thanks: 57
Thanked 2,422 Times in 2,322 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Open popup form on correct position

did you reboot after changing resolution?
i think the op will be using only one resolution.
and other users wll not be be switching resolution just to make it fail.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
gstylianou (11-05-2017)
Old 11-05-2017, 05:35 AM   #10
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Hi arnel

No I didn't reboot - I closed the app, changed the resolution then reopened it.

I'm not criticising your code nor am I trying to make it fail.
My response was based on experience of doing the same thing.

The apps I distribute are used by a large number of users with different screen sizes, shapes & resolutions. I have to make them 'fit' all scenarios.

I use a custom made form resizer that works in almost all cases.
Many of my example databases include that.
It almost always works well
However that too occasionally has issues e.g. option boxes can get over enlarged and tabbed pages can be problematic.

As I wrote in a previous reply:
Quote:
If differing resolutions aren't an issue then by all means go for it.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 11-07-2017, 02:48 AM   #11
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Hi gstylianou

In case you're still looking for a solution that will scale up / down in different resolutions, I just found the attached utility on Stephen Lebans' website: http://lebans.com/openform.htm



For future reference, although many years old, his site is still very useful for anything graphics based

NOTE: It was an old A97 file but I've converted it to ACCDB here.
There was the usual conversion error about user level security no longer being implemented but you can ignore that.

Like most things on his site, the code has lots of complex API calls but the code needed to use the effect on a form is just one line e.g.

Code:
blRet = PositionFormRelativeToControl("Form2", Me.Command0, 0)
I've done the same tests as I did on arnel's solution and it worked every time

I'm going to use it myself to place a popup control zoom form just above the control being 'zoomed'
Attached Images
File Type: png Capture.PNG (23.1 KB, 1095 views)
Attached Files
File Type: accdb A97OpenFormRelativeToControlVer5.accdb (424.0 KB, 99 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Gasman (11-07-2017)
Old 11-07-2017, 03:19 AM   #12
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,545
Thanks: 57
Thanked 2,422 Times in 2,322 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Open popup form on correct position

it doesn't work on x64 access, it's popping on same location. already i converted it to x64 with no errors.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 11-07-2017, 03:51 AM   #13
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Hi arnel

Thanks I was going to try that later ....

Just tried using it for this purpose as I mentioned earlier
Quote:
I'm going to use it myself to place a popup control zoom form just above the control being 'zoomed'
It didn't work.
Perhaps its because the control being clicked is in a subform ...?
Maybe I could get it to do so with a bit more work but I've left it for now as its not that important to me...

For that purpose, I also can't use your solution as the control position varies.
Nor can I use mine due to the nature of the subform

You win some, you lose some ...

Anyway, the OP now has 3 solutions to choose from so at least one should be OK for his/her needs
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 11-07-2017, 08:53 AM   #14
gstylianou
Newly Registered User
 
Join Date: Dec 2013
Posts: 194
Thanks: 35
Thanked 4 Times in 4 Posts
gstylianou is on a distinguished road
Re: Open popup form on correct position

Dear friends, thanks a lot for your help....was really useful all details..!!

Moreover, my friend Ridders, the link you send me about to download an example is not working because i'm using Access 2016 32Bit.... Any idea?

Thanks again all of you
gstylianou is offline   Reply With Quote
Old 11-07-2017, 08:57 AM   #15
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,761
Thanks: 107
Thanked 2,644 Times in 2,420 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open popup form on correct position

Hi

I'm also working in A2010 32-bit so I'm not sure which link you're referring to.

If you are referring to the link on Stephen Lebans' website, I also attached an accdb version of the same file in that post so you don't need to do it yourself.

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using If to load correct form on DB open WineSnob Modules & VBA 1 09-22-2014 07:45 AM
Alter start position of popup form Eric the Viking Modules & VBA 0 08-22-2013 06:46 AM
SQL to open correct form christakis Modules & VBA 4 11-17-2009 08:20 AM
Open form as a popup abhiutd Forms 4 08-18-2008 08:10 AM
Can't open form to correct record hcoburn Modules & VBA 7 02-11-2008 05:42 PM




All times are GMT -8. The time now is 01:32 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World