Using buttons to enter data in to fields (1 Viewer)

XPS35

Active member
Local time
Today, 11:18
Joined
Jul 19, 2022
Messages
159
That is my point. Which is why I mentioned the last dirty field. Maybe that could be used in the vba to say that the location that is clicked is added to the field that is last made dirty. This would allow users to change the locations.
I don't think that will help. The user might not want to change the last one, but the one before.
 

Mike Krailo

Well-known member
Local time
Today, 05:18
Joined
Mar 28, 2020
Messages
1,044
You could just use the mouse down event and test for left click for start location and ctrl+click for loading destination. Very simple.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:18
Joined
Jul 9, 2003
Messages
16,282
I want it to be so that the location names are all buttons on a map.

A few years ago, I addressed a similar question. I suggested using an image to capture mouse pointer coordinates and associating them with a database, which might be a more efficient approach for you than using buttons. You can find the discussion in this thread:

 

jacko6

New member
Local time
Today, 17:18
Joined
Jul 17, 2023
Messages
25
... or just have 2 maps, one for start and one for end. Could put them side by side or in a tab ctl etc.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:18
Joined
Sep 21, 2011
Messages
14,301
Combos would also not use the keyboard?
 

omarrr128

Member
Local time
Today, 10:18
Joined
Feb 5, 2023
Messages
69
@omarrr128 - you appear to respond only to posts you receive a notification about - all I can say is that is a a bad practice and one that will put responders (certainly me) off from responding with alternatives. When you come back to the thread, take care to review and respond to all responses since your last post.


Not as such - see post #5. If you want the maintenance involved every time you add or remove a location, then just add the labels at each location and use the code in the label mouse up event and remove the code for the image events. The right click code I provided to add locations was just for demo purposes to add locations so (I suspect) can be ignored. You can use a textbox or a button instead of a label, but they come with additional requirements. And no need for a label to popup since you are (presumably) displaying the same information, just add the code to your textbox of button instead

Your requirement is quite vague so far - what is a map? - a town?, a country?, a continent? the world? or something else? What defines a start or end location? Why do you need a button (or textbox or label) for each location. Answer these questions and everyone might get some clarity on the actual requirement.

Recommend you provide context by describing the business and the purpose behind the requirement. My example provides discrete broad base locations but probably not suitable if one location if '1 Carnaby Street' and '2 Carnaby Street' are considered to be different locations - but that also depends on the scale of the 'map'.
Sorry for the late reply. I apologise that you see it that way. I tend to start off by answering the smaller replies first and then the bigger, more important ones. Otherwise I wouldn't be bothered to reply to the small ones after. Unfortunately I don't get paid for any of this work on the database I'm doing.

Thank you for all your help I really do appreciate it. As good as your demo looked, unfortunately it won't work as well with my database. The map is more like a floor plan made up of rooms as opposed to a geographical map with pin points.

There is also a lot of code involved and I am not that tech savvy to understand how to implement it all!

Thank you very much for your time however.
 

omarrr128

Member
Local time
Today, 10:18
Joined
Feb 5, 2023
Messages
69
Kindly let us know how it goes. Good luck!
The vba you suggested was just what I was looking for. It works exactly how I wanted.

thank you very much for your help you were the only one to suggest it! :)

I used another set of buttons to assign focus back to the appropriate fields if they wanted to amend the location
 

Mike Krailo

Well-known member
Local time
Today, 05:18
Joined
Mar 28, 2020
Messages
1,044
Wait what was suggested that worked for you. I looked back and only seen link to a post describing screen active control by DbGuy. Not sure how that solved your problem. Just so everyone is clear on the solution that you selected, please elaborate on what you did exactly.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:18
Joined
Feb 19, 2013
Messages
16,612
Unfortunately I don't get paid for any of this work on the database I'm doing.
and I don't get paid to provide you with help.

If you had looked at the code I provided, you will have seen that although only a point is stored, the code is triggered when the mouse is over a square centred on that point Can easily be adapted to store squares or rectangles of different sizes, or any other shape instead with a bit of extra maths.

Anyway, you have a solution, so I'll bow out
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:18
Joined
Oct 29, 2018
Messages
21,473
The vba you suggested was just what I was looking for. It works exactly how I wanted.

thank you very much for your help you were the only one to suggest it! :)

I used another set of buttons to assign focus back to the appropriate fields if they wanted to amend the location
Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom