troubleshooting Question

How to call a Function in Ms Access with bytes

Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScFlag for Zambia asked on
Microsoft Access
10 Comments1 Solution13 ViewsLast Modified:
I want to call the function below in a sub in Ms Access , how do I do it:

Function RecvAryReal(dataBuf() As Double) As Long
Dim x As Long
' this are special function for byte array doings
' if we want to delimeter the code
' this helps us then complex communication with
' the enc28j60 connected µC device

    ' receive DOS format 64bit binary data

    Dim buf As String * 20
    Dim size As Long
    Dim length As Long
    Dim count As Long
    ' this is special for communicate with
    ' OSZ or other devices later
    ' .. ;-)
    Dim recvBuf(25616) As Byte
    ' receive header info "ROY<##"
    ' we can setup here our Startcode too
    ' but we do this in the "worker makro later"
    x = recv(socketId, buf, 8, 0)
    size = Val(Mid$(buf, 3, 6))
    count = 0
    length = 0
    Do While length < size
        count = recvB(socketId, recvBuf(length), size - length, 0)
        If (count > 0) Then
            length = length + count
        End If
    ' receive ending LF
    count = recv(socketId, buf, 1, 0)
    ' copy recieved data to Single type array dataBuf()
    CopyMemory dataBuf(LBound(dataBuf)), recvBuf(0), length
    'dataBuf = recvBuf
    RecvAryReal = length / 8
End Function

Open in new window

Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros