Solved

Passing Variant to Function (for my "Audit"

Posted on 2013-01-20
2
375 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 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