Results 1 to 3 of 3
  1. #1
    pwyller is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    5

    Update a field with the results of a math formula from Excel


    Here is the Excel formula:

    =CONCATENATE(DEC2HEX(RANDBETWEEN(0,65535),4),"-",DEC2HEX(RANDBETWEEN(0,65535),4),"-",DEC2HEX(RANDBETWEEN(16384,20479),4),"-",DEC2HEX(RANDBETWEEN(32768,49151),4))

    Is there any way I can create this random 4 chunk hex code in Access and put it in an update query?


  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    There is no direct conversion for the Excel functions in Access. You could call the Excel workbook functions - there are examples if you google for them.

    I wrote a function that seems to work - actually I wrote two. Not sure what you are trying to do.

    Open the attached dB, then open Query1. Look at the Hex numbers, then press F5. Press F5 again. I would say "Press F5 again" but you can see what is happening.
    Attached Files Attached Files

  3. #3
    pwyller is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    5

    I tried this...

    Quote Originally Posted by ssanfu View Post
    There is no direct conversion for the Excel functions in Access. You could call the Excel workbook functions - there are examples if you google for them.

    I wrote a function that seems to work - actually I wrote two. Not sure what you are trying to do.

    Open the attached dB, then open Query1. Look at the Hex numbers, then press F5. Press F5 again. I would say "Press F5 again" but you can see what is happening.

    I tried this:
    Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & "-" & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & "-" & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & "-" & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15) & Hex(Rnd()*15)


    But, it produces the same number for every row.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-21-2016, 04:56 PM
  2. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  3. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  4. Math error in calculated field
    By nashgas in forum Queries
    Replies: 2
    Last Post: 04-03-2012, 11:49 AM
  5. Implementing Math Formula
    By cwwaicw311 in forum Forms
    Replies: 19
    Last Post: 02-24-2010, 08:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums