TASK: check for specific set of software on employee's assigned laptop using a batch file within Access.
Problem: found a solution that creates a function to run the batch file and call that function in a "Run code" Macro. However, I don't know how to capture the value in the field/parameter from the Access sub form "Hardware" that the batch file will use for it's output.
Here is a snapshot of the batch file - checkSoftware.bat
@echo off
IF exist "\\%1\C$\Program Files\Internet Explorer\Iexplore.exe" goto ONE
goto OFFLINE
:ONE
IF exist "\\%1\C$\Program Files\Altova\XMLSpy2016\xmlspy.exe" Echo %1% Has XMLSpy 2016 Installed
IF exist "\\%1\C$\Program Files\Altova\XMLSpy2015\xmlspy.exe" Echo %1% Has XMLSpy 2015 Installed
IF exist "\\%1\C$\Program Files\Altova\XMLSpy2014\xmlspy.exe" Echo %1% Has XMLSpy 2014 Installed
IF exist "\\%1\C$\Program Files\Altova\XMLSpy2013\xmlspy.exe" Echo %1% Has XMLSpy 2013 Installed
goto NOXML
:NOXML
Rem Echo %1% NO XMLSPY Installed
goto OTHER
:OFFLINE
Echo %1% is not online in Building, cannot check for XMLSPY
goto OTHER
:OTHER
IF exist "\\%1\C$\Program Files (x86)\TechSmith\Snagit 9\Snagit32.exe" Echo %1% Has SNAGIT Installed
IF exist "\\%1\C$\Program Files (x86)\Microsoft Office\Office14\visio.exe" Echo %1% Has Visio Installed
IF exist "\\%1\C$\Program Files (x86)\Microsoft Office\Office14\winproj.exe" Echo %1% Has Project Installed
IF exist "\\%1\C$\Program Files\SmartBear\ReadyAPI-1.5.0\bin\ReadyAPI-1.5.0.exe" Echo %1% Has Soap Installed
IF exist "\\%1\C$\Program Files (x86)\Teradata\Client\14.10\bin\bteqwin.exe" Echo %1% Has TeraData Installed
IF exist "\\%1\C$\Program Files (x86)\HP\Unified Functional Testing\bin\Analyzer.exe" Echo %1% Has UFT Installed
IF exist "\\%1\C$\Program Files (x86)\SSH Communications Security\SSH Tectia\SSH Tectia Client\ssh-client-g3.exe" Echo %1% Has Tectia Installed
IF exist "\\%1\C$\Program Files\TextPad 7\Textpad.exe" Echo %1% Has Textpad Installed
goto END
:END
Here is a snapshot of the function in a module that I found online - RunMyBatch
Option Compare Database
Public Function RunMyBatch()
Dim input1 As String
input1 = Forms![EmployeeDetails]!SubForm![Hardware]![ComputerName]
CallShell("c:\DSS\DS\Inventory\InventoryDatabase\c hecksoft.bat")
End Function
'Check Software macro will check the software on anemployee's computer from their hardware record
'run the macro from the [Hardware] subform in [EmployeeDetails] form
Here is what I have created thus far for CheckSW Macro - Check Software is a control button on the Hardware subform which runs this macro
SelectObject
Object Type - Form
Object Name - Hardware subform
In Database Window - yes
If [Forms]![Hardware subform]![Type].[Text]="Laptop"
GoToControl
Control Name - ComputerName
RunCode
Function Name - RunMyBatch
End If
*This is where I'm stuck...the macro runs a OnClick event whenever the "Check Software" button is clicked, but this is the error I get
- "Microsoft Access cannot find the referenced form "Hardware subform"
Hopefully, I explained enough detail, but if not just let me know what I left out. thank you!