Debugging data being passed to my custom public function?

peskywinnets

Registered User.
Local time
Today, 03:33
Joined
Feb 4, 2014
Messages
582
So I'm *very* new to passing fdata to & from a Public function .....how can I test that the data being sent to the function is being received correctly?

for example, in this function call SignURL ...

(keys changed for confidentiality reason)

Code:
Public Function SignURL(strASINs As String) As String

Dim strURL As String
Dim strAccessKeyID As String
Dim strSellerID As String
Dim strMarketplace As String
Dim strSignedURL As String
Dim strCall As String
Dim strVersion As String

strAccessKeyID = "AKInL5HRNS36V6AVWBDA"
strSellerID = "AHWPWD8ERROAY"
strMarketplace = "A1F83G8C2AXO7P"
strASINs = SortASINS(strASINs) 
strAction = "GetCompetitivePricingForASIN"
strVersion = "2011-10-01"


strURL = "https://mws.amazonservices.co.uk/Products/2011-10-01?&AWSAccessKeyId=" & strAccessKeyID & "&Action=" & strAction & "&MarketplaceId=" & strMarketplace & "&SellerId=" & strSellerID & "&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=" & strVersion

strURL = strURL & "&Timestamp=" & GetIsoTimestamp
signed = signEncode(strURL)

Debug.Print strURL
 
End Function

As a first stage, I simply want to pass textual data (for example "A005J38BZ5,A000W9IWAF") to the variable called strASINs from a query.

So in my query I have.....

Test: SignURL("A005J38BZ5,A000W9IWAF")

but I'm not getting anything being returned when I run the query?

In the light I'm not getting anything returned, it would be prudent to step through the code with a 'debug watch' on the variable strASINs ....how can I approach this please?
 
Last edited:
There is nothing returned from your function because you have not set it to the value you want returned.

After your debug.print line, add the line

SignURL = strURL
 
You haven't told it to return anything. ;)

SignURL = Whatever
 
Thanks guys (like I said I was new to all this!)

Code:
Public Function SignURL(strASINs As String) As String

Dim strURL As String
Dim strAccessKeyID As String
Dim strSellerID As String
Dim strMarketplace As String
Dim strSignedURL As String
Dim strCall As String
Dim strVersion As String

strAccessKeyID = "AKInL5HRNS36V6AVWBDA"
strSellerID = "AHWPWD8ERROAY"
strMarketplace = "A1F83G8C2AXO7P"
strASINs = SortASINS(strASINs) 
strAction = "GetCompetitivePricingForASIN"
strVersion = "2011-10-01"


strURL = "https://mws.amazonservices.co.uk/Products/2011-10-01?&AWSAccessKeyId=" & strAccessKeyID & "&Action=" & strAction & "&MarketplaceId=" & strMarketplace & "&SellerId=" & strSellerID & "&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=" & strVersion

strURL = strURL & "&Timestamp=" & GetIsoTimestamp
signed = signEncode(strURL)

SignURL =  strURL
 
End Function


...but I still suspect that data (from the query that I'm using) is not being passed to the function....how can I check this?


Edit: Never mind....I managed to work it out (I set a breakpoint early on in the function :-))
 
Last edited:

Users who are viewing this thread

Back
Top Bottom