Wow fast response thanks pwise,
Only thing is the SET is seting different fields based on the inserted.LVR_Reason data.
14 = SET dbo.TblLotEvents.LE_OrderParts = inserted.LVR_TimeStamp
24 = SET dbo.TblLotEvents.LE_TurnOverlot = inserted.LVR_TimeStamp
Thanks,
Mark
Here is the SQL trigger. It seems to me that checking in the inserted table in the IF statement means I don't need it in the WHERE clause. Any help simplifying this would be appreciated.
CREATE TRIGGER TriggerInstallationComplete ON [mpadmin].[TblLotVisitsReason]
FOR INSERT
AS
IF EXISTS...
I am going to keep using the Top 1 Order By method just in case when I get to altering the ".1" it needs to be bigger or gone.
George really I can't thank you enough =)
Mark
AWSOME,
Thank you again George I think that did it ... an acceptable speed with great results. I will have to play with the ".1" a bit to see what works best but your genius has helped me emensly and I learned a lot to.
Posting code again for people with the same needs some day..
Dim MyDB As...
Even if I am only conserned (for now) with points that are in southern California? Within say 300 miles of eachother max.
I'm new at this whole GPS phone locate the employee thing but that Square root is a killer on the speed.
Mark
Greg,
I ended up using your math with George's SQL from another post. Thanks for the help!
Here is the code I ended up with...
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim MySQL As String
Public Function NearestGeoFence(SearchLatitude As Variant, SearchLongitude As Variant) As...
George
I hope your feeling better and thanks for the help. I ended up using your method with someone elses math for speed.
This is what I ended up with...
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim MySQL As String
Public Function NearestGeoFence(SearchLatitude As Variant...
ok here is what I have ...
Select Min(Sqr((C_Latitude - " & SearchLatitude & ") ^ 2 + (C_Longitude - " & SearchLongitude & ") ^ 2)) As FakeDistance,
C_JobNum,
C_PhaseNumber
From dbo_TblContract
Group By C_JobNum, C_PhaseNumber
But I am getting this ...
This qry returns the wrong C_JobNum and C_PhaseNumber actualy it always returns the 1st record in the table rather than the record the Min statement is returning. Can someone please show me how to make this work correctly?
SELECT Min(Abs([C_Longitude]- (-117.61583))+Abs([C_latitude]-...
Now the function will execute but returns the first C_JobNum and C_PhaseNumber from the table rather than the correct C_JobNum and C_PhaseNumber for the record the Min statement is returning.
I tried that already and I get a runtime error '3122':
You tried to execute a query that does not include the specified expression 'C_JobNum' as part of the aggregate function.
Greg,
Great Idea keeping it simple =) and it works kind of ...
I have this SQL statement...
SELECT Min(Abs([C_Longitude]- " & SearchLongitude & ")+Abs([C_latitude]- " & SearchLatitude & ")) AS NearestJobPhase FROM dbo_TblContract;
This gives me a value returned in NearestJobPhase.
But I...
My code works but is WAY WAY to slow. Please help me to find a better/faster way to find the closest record to given cordinates.
Currently I have code that when given a latitude and longitude it will go record by record thru a table with latitudes and longitudes calculating the distance between...
Thanks Frederico,
I am learning SQL/VB as I go and haven't gotten to stored Procedures yet but I did find DoCmd.RunSQL so now I have this...
Private Function CountMolding()
MySQL = "SELECT * FROM TblItemTransactionTracking WHERE [ITT_CJHLI] = '" & Right(Me.MM_BarCodeScanned...
Ok I have read the FAQ's and searched I don't even know how many boards so now it's time to beg some help.
I have several functions that read/write to a backend SQL database. I have read that it is not good to leave open a record set and to let connection pooling do its job. I had the recorsets...
I have tried exporting to another DB... making a new one and remaking this qry... compacting and repairing... making a new 2000 db in 2003 access and then opening this in 2000. This qry will run but trying to save any change made to it closes access with no error.
Perhaps someone will be good...
I have 3rd party application that uses a access database to keep track of "daily work". I can link to the tables in this aplications database and would like to append the information in the linked tables to my SQL tables as the aplication adds records to its tables.
So...
For each new record...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.