Parameter query run hyperlink & open webpage, for tracking UPS package
I have a parameter query that looks up the tracking # for a given customer_order_ID and outputs the tracking# as a website link, as a single record. Please advise me how I can have the link run aut开发者_运维技巧omatically when the user inputs the customer_order_ID into the parameter query , in order that the user can immediately track the package on the UPS Worldship website. I do not know VBA nor do I know SQL, but I can make macros.
Thank you very much in advanceSELECT T.order_ID, "http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_us&InquiryNumber1=" & [T].[tracking_number] & "&track.x=0&track.y=0" AS link
FROM tblShipmentDataFromAllCarriers AS T
WHERE (((T.order_ID)=[Please enter customer order ID]));
If you don't need to parse the return data and just want to open the web page, you can use Application.FollowHyperlink. But you don't need to do the concatenation with the URL in the SQL:
SELECT T.order_ID, [T].[tracking_number]
FROM tblShipmentDataFromAllCarriers AS T
WHERE (((T.order_ID)=[Please enter customer order ID]));
Then you could store the rest of the URL as constants:
Const c_strURL1 = "http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_us&InquiryNumber1="
Const c_strURL2 = "&track.x=0&track.y=0"
...and then execute it like this:
Public Sub DisplayTrackingNumber(ByVal strOrderID As String)
Dim strTrackingNumber As String
strTrackingNumber = DLookup("tracking_number", "tblShipmentDataFromAllCarriers", "[order_ID]=" & strOrderID)
Application.FollowHyperlink strUrl1 & strTrackingNumber & strUrl2
End Sub
You'd then have to have a UI to collect the OrderID from the user (I'd suggest a form with a combo box) and then call this sub.
精彩评论