Solved

Passing Variant to Function (for my "Audit"

Posted on 2013-01-20
2
337 Views
Last Modified: 2013-01-20
Hi,

1. I am fine tuning my audit procedures on my forms.

2. e.g. "User: Joe changed StreetName from 'High Street' to 'Low Street' at 12:22 on Jan 12"

3. I have created a new function called "RecordAudit".  

Dim acontrolnames As Variant
    
    acontrolnames = Array("CustomerName", "Email", "WindowCount", "DateReported", "SiteVisitRequired" _
    , "CallOutCharge", "FaultyWindowCount")
            
    RecordAudit (acontrolnames)

Open in new window




4. From this code you can see that I call function RecordAudit.
5. For simplicity sake I wish to "msgbox CustomerName.OldValue"   and all the fields within the variant.

How do I display these fields.
(I guess I am unsure how to pass the variant and then process each field)
0
Comment
Question by:Patrick O'Dea
2 Comments
 
LVL 6

Accepted Solution

by:
esolve earned 500 total points
ID: 38798423
Sub x()
    Dim vntArray As Variant
    Dim strBuf As String
    Dim intIndex As Integer
     
    vntArray = Array(10, 20, 30, 40, 50)
    For intIndex = LBound(vntArray) To UBound(vntArray)
        strBuf = strBuf & "Index " & intIndex & " = " & vntArray(intIndex) & vbLf
    Next
    MsgBox "My Array contains the following " & vbLf & strBuf, vbInformation
     
End Sub
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 38798804
to be re-visited!

Thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now