Dave,
Thanks for the nice example.
I used it to try a mock up as follows:
Created 2 functions
-fncMakeTempVars
-GetSettings
Created 1 Named Macro (based on DaveGri sample)
-macTempVar
RunCode Function Name fncMakeTempVars
Used an existing table _ApplicationObjectList
The only record in the table is:
Id |
ObjType |
ObjName |
ObjLocation |
ObjCleanLocation |
ObjModLocation |
sysDateAdded |
1 |
2 |
DBObjects |
C:\Users\JP\AppData\Local\DbgSaveRaw\Form_DBObject s.txt |
C:\Users\JP\AppData\Local\DbgClean\Form_DBObjects. txt |
C:\Users\JP\AppData\Local\DbgWithDebug\Form_DBObje cts.txt |
07-Sep-22 7:18:14 PM |
Here are the functions:
Code:
Option Compare Database
Option Explicit
' ----------------------------------------------------------------
' Procedure Name: fncMakeTempVars
' Purpose: Mockup to get values from a table and assign these to Tempvars
' Procedure Kind: Function
' Procedure Access: Public
' Author: Jack
'(Based on Davegri sample https://www.accessforums.net/showthread.php?t=86612&p=500258#post500258)
' Date: 09-Sep-22
' ----------------------------------------------------------------
Function fncMakeTempVars()
Dim tmpv1 As TempVars 'dim 2 tempvars
Dim tmpv2 As TempVars
10 GetSettings 'run a function to get some values
20 TempVars!tmpv1 = Split(GetSettings, "|")(0) 'assign retrieved values to tempvars
30 TempVars!tmpv2 = Split(GetSettings, "|")(1)
40 MsgBox "TempVar1: " & TempVars!tmpv1 & vbCrLf & "TempVar2: " & TempVars!tmpv2
End Function
Code:
' ----------------------------------------------------------------
' Procedure Name: GetSettings
' Purpose: To retrieve some values from a table
' Procedure Kind: Function
' Procedure Access: Public
' Author: Jack
' Date: 09-Sep-22
' ----------------------------------------------------------------
Function GetSettings()
Dim a As String, b As String
10 a = DLookup("ObjLocation", "_ApplicationObjectList")
20 b = DLookup("ObjCleanLocation", "_ApplicationObjectList")
30 GetSettings = a & "|" & b
End Function
The result of running the macro:
May not be what OP needs, but should provide some insight.