Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating Question 1

Status
Not open for further replies.

Dodge

IS-IT--Management
Jun 14, 2001
25
0
0
US
I am trying to use a variable to define a field using DAO, for example:

Dim dbs As Database
Dim rst As DAO.Recordset
Dim Location as String, PartStr as String
Dim RecParts as Integer

Location = Combo1.Value
PartStr = Combo45.Value

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT [" & Location & "] FROM [dbo_Inv Master] where [Inventory Part] = '" & PartStr & "'")

With rst
.Edit
![&quot;& Location &&quot;] = RecParts <---HERES MY PROBLEM
.Update
End With

Within the &quot;With&quot; statment, I can't get it to reconize that the value of &quot;Location&quot; is a field.

Any thoughts?

Thanks Dodge

 
Dear Dodge,

try this:

Set rst = dbs.OpenRecordset(&quot;SELECT [&quot; & Location & &quot;] AS bob FROM [dbo_Inv Master] where
[Inventory Part] = '&quot; & PartStr & &quot;'&quot;)


With rst
.Edit
!bob = RecParts <---HERES the alias
.Update
End With


regards Astrid
 
You RULE! Worked like a champ, Thanks Astrid...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top