Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 109
  • Last Modified:

VB Script Microsoft Access, ADO, field name with spaces

Using VB Script to retrieve values from an Access database.  I can use brackets in the sql to wrap around a field with spaces.
When I use the field in the recordset, I get the error.

How do I reference a field with spaces?


Sceenshot of problem
0
maxdbase
Asked:
maxdbase
  • 2
1 Solution
 
maxdbaseAuthor Commented:
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
One thing you can do is alias the field in the SQL statement:

[FY16 Annual_Target] as Target

Then refer to Target as the field.

Jim.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Also might want to just try:

rsA("[FY16 Annual_Target]")

Jim.
0
 
Dale FyeCommented:
or rsA![FY16 Annual_Target]
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now