Solved

VB Script Microsoft Access, ADO, field name with spaces

Posted on 2016-08-18
4
61 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now