Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB Script Microsoft Access, ADO, field name with spaces

Posted on 2016-08-18
4
78 Views
Last Modified: 2016-08-19
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
Comment
Question by:maxdbase
  • 2
4 Comments
 

Author Comment

by:maxdbase
ID: 41760913
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 41760961
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
 
LVL 57
ID: 41760968
Also might want to just try:

rsA("[FY16 Annual_Target]")

Jim.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 41762240
or rsA![FY16 Annual_Target]
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question