Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

JavaScript Javascript (?) error in MS Access

OzFoxy

New Coder
Hi, my knowledge of js is zero. My need is to create QR Codes in an access database and store them on disk as an image (.png) for inclusion in reports.
I am using sample code downloaded from the internet and the QR Code is created OK and displayed in an image control - Line 120.
The next step, Line 140, fails with error "Unable to get property 'src' of undefined or null reference".
Code:
120       oWebBrowserObject.Document.parentWindow.execScript (sCmd)

130        If IsNull(Me.ID) = False Then
140            oWebBrowserObject.Document.parentWindow.execScript ("var qr = $('#qrcode img')[0].src;")
150            sQRCode = oWebBrowserObject.Document.Script.qr
160            sQRCode = Replace(sQRCode, "data:image/png;base64,", "")    'Remove the initial string portion that isn't relevant
170            If sQRCode <> "" Then
180                WriteByteArrayToFile DecodeBase64(sQRCode), sQRCodesPath & Me.ID & ".png"
190            End If
200        End If
Any advice will be appreciated.
 
Solution
One thing that comes to my mind is, that QR plugin needs some time to render the image first.
Basicly, you are moving too fast with your code.

Just place a short sleep, 500ms or something at line 125 and you might be able to solve this.
Thanks EkBass. The solution I got from another Forum was a windows registry edit to create a new DWord in FeatureBrowserEmulation (msaccess.exe with a value of 11001).
Your advice also makes eminent sense, so I have implemented that as well.
All good. Working well. Now I know two things about js.
One thing that comes to my mind is, that QR plugin needs some time to render the image first.
Basicly, you are moving too fast with your code.

Just place a short sleep, 500ms or something at line 125 and you might be able to solve this.
 
One thing that comes to my mind is, that QR plugin needs some time to render the image first.
Basicly, you are moving too fast with your code.

Just place a short sleep, 500ms or something at line 125 and you might be able to solve this.
Thanks EkBass. The solution I got from another Forum was a windows registry edit to create a new DWord in FeatureBrowserEmulation (msaccess.exe with a value of 11001).
Your advice also makes eminent sense, so I have implemented that as well.
All good. Working well. Now I know two things about js.
 
Solution

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom