leon_prenter
June 11th, 2007, 11:22 PM
Hi,
I'm trying to use VBA to extract a string value from a table in a database.
My effort is below:
Private Sub Command0_Click()
Dim SQLString As String
Dim db As Database
Dim MachineName As String
Dim Category As String
Dim FileName As String
Stop
Set db = CurrentDb
MachineName = "jkl"
SQLString = "SELECT UserClassification FROM ContactDetails WHERE MachineName = " & MachineName
Set Category = db.OpenRecordset(SQLString, String)
'FileName = "UT" & Category
'DoCmd.OpenReport FileName
End Sub
Can anyone tell me what I need to do?
I'm trying to use VBA to extract a string value from a table in a database.
My effort is below:
Private Sub Command0_Click()
Dim SQLString As String
Dim db As Database
Dim MachineName As String
Dim Category As String
Dim FileName As String
Stop
Set db = CurrentDb
MachineName = "jkl"
SQLString = "SELECT UserClassification FROM ContactDetails WHERE MachineName = " & MachineName
Set Category = db.OpenRecordset(SQLString, String)
'FileName = "UT" & Category
'DoCmd.OpenReport FileName
End Sub
Can anyone tell me what I need to do?