Results 1 to 14 of 14
  1. #1
    shod90 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    134

    Connect to a weight scale using com port in access form


    Dear Gents , I have an electronic scale connected to my PC using RS232 .. I need to make a tiny software that read from scale the weight and insert in a table that weight.
    i have been searching a lot for a solution but i didn't find a code except for EXCEL ,, I can't understand well the code written in excel , But when i open that code it works perfectly and read from scale .
    The only favor i need is to change the code from excel to be working on access , Can someone do that favor for me?.
    Excel COMM interface without 3rd party files.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    normally you can import (or copy/paste) the modules into access modules and call them the same way.

    Tho my Access 2019 crashes when the com port activates. Older versions of access seem to work, but not 2019.
    To get around it, I had to use the excel app (just like yours) to copy the value to clipboard then it pastes it into an access textbox.
    It was a long way to get there but it worked.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,283
    The code supplied is referring to ranges , so major rewrite needed.
    It is also 64bit.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Please have a look at the attached file, I have converted the Excel code you provided. Please note that it is totally untested as I do not have a COM port on my laptop.

    Cheers,
    Vlad
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    shod90 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    Quote Originally Posted by Gicu View Post
    Please have a look at the attached file, I have converted the Excel code you provided. Please note that it is totally untested as I do not have a COM port on my laptop.

    Cheers,
    Vlad
    brilliant !!! it starts reading from the scale but it keep reading continuously and with a weird format .
    Click image for larger version. 

Name:	12.PNG 
Views:	110 
Size:	38.3 KB 
ID:	45326

    and yes the weight i put on the scale was 0.390 KG
    but i only need to be one value without B0 which beside the reading.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    I assume you got that by clicking Connect? The way the original code works is to keep reading from the COM port until you disconnect. A bit later when I get home I'll update the sample to do a one time reading.
    Cheers,
    Vlad

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Can you please try this one (click the Read Scale button)?

    Cheers,
    Vlad
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #8
    shod90 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    Quote Originally Posted by Gicu View Post
    Can you please try this one (click the Read Scale button)?

    Cheers,
    Vlad
    Works great , remains some editing on the code to become suitable with my case and that’s my turn .
    Thanks alot

  9. #9
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    You're very welcome, good luck with your project!
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #10
    Join Date
    Dec 2022
    Posts
    3
    Hello sir
    I need the attached file but i cannot download it please help me
    umarrahman311@gmail.com

  11. #11
    Join Date
    Dec 2022
    Posts
    3
    Hi @shod90
    I need the access file
    When i click on the attachment nothing happens
    Please send me the file
    Thanks in advance

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,283
    Quote Originally Posted by Umar Yousufzai View Post
    Hi @shod90
    I need the access file
    When i click on the attachment nothing happens
    Please send me the file
    Thanks in advance
    Worksfor me?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    Join Date
    Dec 2022
    Posts
    3
    Ok done.....
    I was trying on my phone.
    Thanks for your reply.

  14. #14
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,283
    Quote Originally Posted by Umar Yousufzai View Post
    Ok done.....
    I was trying on my phone.
    Thanks for your reply.
    Strangely enough I tested it on my phone, as I was parked in a hospital car park?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. MS Access - Graphing, Adjust scale via code
    By ironfelix717 in forum Forms
    Replies: 12
    Last Post: 03-20-2020, 12:02 AM
  2. Replies: 4
    Last Post: 07-18-2019, 10:10 AM
  3. Replies: 2
    Last Post: 06-02-2017, 04:43 PM
  4. Replies: 1
    Last Post: 10-02-2012, 07:31 PM
  5. Replies: 5
    Last Post: 03-29-2009, 07:20 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