Difference between revisions of "Microsoft Access modWsh"
Jump to navigation
Jump to search
Line 55: | Line 55: | ||
getUserTempTable = strResult | getUserTempTable = strResult | ||
+ | End Function | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === getUserTempQuery === | ||
+ | <syntaxhighlight lang="vb"> | ||
+ | Public Function getUserTempQuery(strSource As String) As String | ||
+ | Dim strResult As String | ||
+ | |||
+ | Const strTablePrefix = "_qry" | ||
+ | |||
+ | strResult = strTablePrefix & Mid(strSource, 4) & getUserSuffix | ||
+ | |||
+ | getUserTempQuery = strResult | ||
End Function | End Function | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 13:47, 1 September 2010
getUserName
Function getUserName() As String
Dim strResult As String
Dim wshNet As WshNetwork
Set wshNet = New WshNetwork
strResult = wshNet.UserName
getUserName = strResult
End Function
getComputerName
Function getComputerName() As String
Dim strResult As String
Dim wshNet As WshNetwork
Set wshNet = New WshNetwork
strResult = wshNet.ComputerName
getComputerName = strResult
End Function
getUserSuffix
Public Function getUserSuffix() As String
Dim strResult As String
strResult = getUserName
strResult = Replace(strResult, ".", "")
strResult = Replace(strResult, ",", "")
strResult = Replace(strResult, "-", "")
strResult = Replace(strResult, " ", "")
strResult = "_" & strResult
getUserSuffix = strResult
End Function
getUserTempTable
Public Function getUserTempTable(strSource As String) As String
Dim strResult As String
Const strTablePrefix = "_tbl"
strResult = strTablePrefix & Mid(strSource, 4) & getUserSuffix
getUserTempTable = strResult
End Function
getUserTempQuery
Public Function getUserTempQuery(strSource As String) As String
Dim strResult As String
Const strTablePrefix = "_qry"
strResult = strTablePrefix & Mid(strSource, 4) & getUserSuffix
getUserTempQuery = strResult
End Function