Hi all
i have a database that creates work tickets which is working really well, the problem i have is this.
I have a form "Support Form" that collects the computer name in a text field called "text142" when the form opens, this is done by using a module using this code.
Option Compare Database
Option Explicit
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" ( _
ByVal lpBuffer As String, _
ByRef nSize As Long) As Long
Function ComputerName() As String
Dim stBuff As String * 255
Dim lAPIResult As Long
Dim lBuffLen As Long
lBuffLen = 255
lAPIResult = GetComputerName(stBuff, lBuffLen)
If lBuffLen > 0 Then
ComputerName = Left(stBuff, lBuffLen)
End If
End Function
what i am trying to do is lookup the ID of the computer in the "Asset" table using the name of the PC "AssetName", and put the ID in a text field called "answer"
all the computers on our network use the naming convention PC-**-** were ** is either a letter or number
i am using this as my dlookup
Me.answer = DLookup("[AssetID]", "Asset", "[AssetName]= " & [ComputerName])
the problem i have is that the look up always give this error
Runtime Error 2471
the expression you entered as a query parameter produced this error 'PC'
any help would be fantastic
Steve