Maybe I missunterstood the difference between TempVars
and TempVar
.
As i know TempVars
represents the collection of 255 TempVar.
TempVar
is one of the variable inside the TempVars
collection.
So if i declare this in a module:
Option Compare Database
Option Explicit
Public GlobalTemp As TempVars
Public CurrentUser As TempVar
Public CurrentSecurity As TempVar
Public UserLogin As TempVar
GlobalTemp
is the name of the TempVars
collection and the others below are its TempVar
variables?
If that is true, inside an hypothetic Login form i have to use the TempVar in this way?
TempVar!CurrentUser.Value = Me.txtUsername.Value
Use TempVar to declare a variable as a TempVar type. Then can loop through TempVars collection by iterating the TempVar variable. Example:
Sub test()
TempVars!x = "ABC"
TempVars.Add "y", "DEF"
Dim z As TempVar
For Each z In TempVars
Debug.Print z.Name & ";" & z
Next
End Sub
MS documentation: https://learn.microsoft.com/en-us/office/vba/api/Access.TempVar.