Assign result to string

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi,

How do I assign a value to a string base on the query.

The code is:

Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim str As String
Dim Something As String

Set db = CurrentDb
Query = "SELECT ComputerName FROM Computer WHERE
ComputerName = '" & Me.Text11 "'"
Set rs = db.OpenRecordset(Query)

' What i need to do to assign the results to the the
string "something" so that it has the value
computername.


Thanks,

Ben
 
If rs.RecordCount > 0 Then
If Not IsNull(rs!ComputerName) Then
Something = rs!ComputerName
End If
End If
 
Thanks
-----Original Message-----
If rs.RecordCount > 0 Then
If Not IsNull(rs!ComputerName) Then
Something = rs!ComputerName
End If
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top