ckangas7
asked on
Referencing checkbox on form from Module
This is a simple one, but I still don't quite understand the naming / path references to object in Access VBA. I have a checkbox called sparbox on a form named Spartan Report Dialog. I am trying to reference the checkbox in the following module. I tried
If Sparbox
If Me!Sparbox
and what you see below. What is the correct way to reference the location of my checkbox object?
Module:
If Sparbox
If Me!Sparbox
and what you see below. What is the correct way to reference the location of my checkbox object?
Module:
Sub rename()
Dim objWMI: Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
If Forms![Spartan Report Dialog]!Me!sparbox = True Then
Set colFiles = objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='C:\Central Billing\Import\Spartan'} Where ResultClass = CIM_DataFile")
Else
Set colFiles = objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='C:\Central Billing\Import'} Where ResultClass = CIM_DataFile")
End If
For Each objFile In colFiles
If LCase(objFile.Extension) = "psd" Then objFile.rename (Replace(LCase(objFile.Name), ".psd", ".csv"))
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER