I purchase USB drives by the case. I have some that I bought decades ago. I usually back up database files every week. Thanks for reminding me that it is Friday.
To see some animation in access, here are some Heuristic solutions to the Traveling Salesman problem. You can watch the solutions unfold.
1. Add all the capitals to your selected cities in yellow
2. These are improving algorithms so you can start with Closest neighbor, then 2 opt Swap, then 3 opt etc. They all demo some animation of the building of the solution. Yours would be some version of that code. View attachment 120649
I forgot to reply to your post. I haven't touched PBI in more than a decade, maybe two. I am building my finance and health application for use by non-techies, most of whom do not use Excel or PowerPoint. The food recall map is one of about 500 forms currently in the database.
I forgot to reply to your post. I haven't touched PBI in more than a decade, maybe two. I am building my finance and health application for use by non-techies, most of whom do not use Excel or PowerPoint. The food recall map is one of about 500 forms currently in the database.
Pete, your solution is outstanding.
I need to find someone whose PC isn't locked down the way that mine is, so I can look under the hood. My PC won't let me open a zip file.
In the meantime, tell me how the line forms. Does it start with the first capitol and then display the others in a set order?
Do you use the .Move function?
Does each line segment have the same time delay?
I haven't seen anything so cool since I was doing GIS.
No this is very basic. It is only to show that you can give a sense of animation even though there is really no animation.
There are 48 hidden lines
The table has the x,y position of each capital
You pass a hidden line to the function and what cities to connect. Each city is in the table and you then have the x,y positions in the table. It then sets the line properties of top, left, height, width, and slant (left or right slant). The positions are relative to the image control so you have to add in the top and left (miTop, miLeft)
Code:
'----------------------------------------------------------- Display Functions -------------------------------------------
Public Function lnSlant(RouteLine As Line, Optional bClear As Boolean, Optional City1 As String, Optional City2 As String)
Dim City1Top As Long
Dim City1Left As Long
Dim City2Top As Long
Dim City2Left As Long
Dim miTop As Integer
Dim miLeft As Integer
miTop = Me.Image25.Top
miLeft = Me.Image25.Left
If bClear = True Then
RouteLine.Visible = False
Exit Function
End If
RouteLine.Visible = True
City1Top = DLookup("MapTop", "tblCities", "CityName = '" & City1 & "'")
City2Top = DLookup("MapTop", "tblCities", "CityName = '" & City2 & "'")
City1Left = DLookup("MapLeft", "tblCities", "CityName = '" & City1 & "'")
City2Left = DLookup("MapLeft", "tblCities", "CityName = '" & City2 & "'")
If City1Top > City2Top Then
RouteLine.Top = City2Top + miTop
Else
RouteLine.Top = City1Top + miTop
End If
If City1Left > City2Left Then
RouteLine.Left = City2Left + miLeft
Else
RouteLine.Left = City1Left + miLeft
End If
RouteLine.Height = Abs(City1Top - City2Top)
RouteLine.Width = Abs(City1Left - City2Left)
If (City1Top > City2Top And City1Left < City2Left) Or (City1Top < City2Top And City1Left > City2Left) Then
RouteLine.LineSlant = True
Else
RouteLine.LineSlant = False
End If
End Function
There is no delay in the rendering because the calculations are happening behind the scenes which creates the delay.
You may think that finding the shortest path between 50 states is simple and you could just build a loop to go through all possibilities. The problem with that logic is that it is 50! (50 factorial) possibilities. 3 x 10^ 64. Or 3 followed by 64 more zeroes. Probably about the number of stars in the universe. This is a classic optimization problem and can be solved using linear programming. Even that is a pain to formulate if you have a solver.
These solutions are heuristics. They cannot guarantee or prove the solution, but it is probably pretty close.
They all work the same way. They take any path and improve on it. They break one, two, or three paths and try to rearrange to get a shorter path. If a shorter path it found it keeps it. You can iterate forever so these algorithms kick out after a certain amount of iterations without change.
I purchase USB drives by the case. I have some that I bought decades ago. I usually back up database files every week. Thanks for reminding me that it is Friday.
No this is very basic. It is only to show that you can give a sense of animation even though there is really no animation.
There are 48 hidden lines
The table has the x,y position of each capital
You pass a hidden line to the function and what cities to connect. Each city is in the table and you then have the x,y positions in the table. It then sets the line properties of top, left, height, width, and slant (left or right slant). The positions are relative to the image control so you have to add in the top and left (miTop, miLeft)
Code:
'----------------------------------------------------------- Display Functions -------------------------------------------
Public Function lnSlant(RouteLine As Line, Optional bClear As Boolean, Optional City1 As String, Optional City2 As String)
Dim City1Top As Long
Dim City1Left As Long
Dim City2Top As Long
Dim City2Left As Long
Dim miTop As Integer
Dim miLeft As Integer
miTop = Me.Image25.Top
miLeft = Me.Image25.Left
If bClear = True Then
RouteLine.Visible = False
Exit Function
End If
RouteLine.Visible = True
City1Top = DLookup("MapTop", "tblCities", "CityName = '" & City1 & "'")
City2Top = DLookup("MapTop", "tblCities", "CityName = '" & City2 & "'")
City1Left = DLookup("MapLeft", "tblCities", "CityName = '" & City1 & "'")
City2Left = DLookup("MapLeft", "tblCities", "CityName = '" & City2 & "'")
If City1Top > City2Top Then
RouteLine.Top = City2Top + miTop
Else
RouteLine.Top = City1Top + miTop
End If
If City1Left > City2Left Then
RouteLine.Left = City2Left + miLeft
Else
RouteLine.Left = City1Left + miLeft
End If
RouteLine.Height = Abs(City1Top - City2Top)
RouteLine.Width = Abs(City1Left - City2Left)
If (City1Top > City2Top And City1Left < City2Left) Or (City1Top < City2Top And City1Left > City2Left) Then
RouteLine.LineSlant = True
Else
RouteLine.LineSlant = False
End If
End Function
There is no delay in the rendering because the calculations are happening behind the scenes which creates the delay.
You may think that finding the shortest path between 50 states is simple and you could just build a loop to go through all possibilities. The problem with that logic is that it is 50! (50 factorial) possibilities. 3 x 10^ 64. Or 3 followed by 64 more zeroes. Probably about the number of stars in the universe. This is a classic optimization problem and can be solved using linear programming. Even that is a pain to formulate if you have a solver.
These solutions are heuristics. They cannot guarantee or prove the solution, but it is probably pretty close.
They all work the same way. They take any path and improve on it. They break one, two, or three paths and try to rearrange to get a shorter path. If a shorter path it found it keeps it. You can iterate forever so these algorithms kick out after a certain amount of iterations without change.
I understand some of what you are doing. But I need to study my Access books to better understand DLookups.
I have been using .Visible statements for almost a decade. I used them first in my Sunset Crater graphic. I created it circa 2010 to show the competitive advantages of companies. The form has five calculated measures. Circles represent volcanic bombs that erupt from a crater and roll down the flanks of a volcano, in this case, Sunset Crater in Northern Arizona. The circles are red, yellow, and green, representing a company's competitive strengths or weaknesses.
When I mention animation in Access, I am referring to objects physically moving on a form. If I remember correctly from Alessandro's presentation in 2020, ships moved on the Mediterranean Sea from Italy to Sicily.
I tried doing that in a logistic regression application that I started about five years ago. The statistics weren't that difficult once I understood the type of logarithm to use. The problem was the animation because I had to determine all those darn four-digit coordinates in a form. I considered kidnapping Alessandro and bringing him to the US, but he screamed and kicked to stay in Germany at the time.
Gasman, I create backups based on the amount of work that I do in between backups. Usually, after I create 20 or so new forms/reports, I back up the database. I figure that I can recreate that many objects if my PC goes belly up. Now that my memory has gotten bad, perhaps I should do backups after 10 new forms. In other words, twice a week.
This Food Recall form has been a real challenge. I envision something new for it every morning when I wake up at 2 am. I go back to sleep at 4. I get up later to do internet research on various diseases and medicines.
I didn't think it was too much older than 10 years so I googled it. There are a number of dates starting in 2011 but it suggests a public release in 2015
See if this is of interest. You can look at that video on risks to see possible features you can add. I had multiple ways to filter the list.
I did not add the filters, but I have a listbox on the left where you could turn on and off the display of different states.
I set this up where you pick a recall from the top and it shows the states with that recall.
Showing multiple recalls per state could be done but you only have so much real estate.
I did not add the locations for all the states, but it is really easy to do. I added a function where I open the form in design view and position a cmd button where I want it and update a function to save the positions.
That data being displayed comes from the normalized table