ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   import database tabase (https://www.excelbanter.com/excel-programming/396786-import-database-tabase.html)

carmen

import database tabase
 
Hello,

I recorded the macro that creates a query table from MS Access. I'm
replacing the "Where..." SQL to something more flexible. ie, In excel I'm
allowing user to pick the criteria from 20+ fields (from a pivot). I'd like
to add to SQL all those fields that have a selection other than "All". (I'm
doing this because my end product can only be a query table).

I'm noticing that the querytable only refreshes with certain fields. Some
field selections do not work. Where could I find the requirements for the
string?

My field names/data are sometimes numbers, text (but numeric),
single/multiple words, phrases with "," or ".". I noticed that sometimes I
need to use " ' " and sometimes " ` ". But in what cases should I be using
them? Also, of field names are two words, should I use []?

Thanks,
Carmen

barnabel

import database tabase
 
In general terms, it depends on the type of the field in the database. If
the field is type text then the value you are looking for needs to be
enclosed in quotes. If the field name has spaces in it then it needs to be
enclosed in [ ] Like [Field Name] = 'value'

Since you recorded a macro to show you how to make the query, you could
always record one where you set a condition on each of the fields to see what
is recorded for each field.

Peter Richardson

"Carmen" wrote:

Hello,

I recorded the macro that creates a query table from MS Access. I'm
replacing the "Where..." SQL to something more flexible. ie, In excel I'm
allowing user to pick the criteria from 20+ fields (from a pivot). I'd like
to add to SQL all those fields that have a selection other than "All". (I'm
doing this because my end product can only be a query table).

I'm noticing that the querytable only refreshes with certain fields. Some
field selections do not work. Where could I find the requirements for the
string?

My field names/data are sometimes numbers, text (but numeric),
single/multiple words, phrases with "," or ".". I noticed that sometimes I
need to use " ' " and sometimes " ` ". But in what cases should I be using
them? Also, of field names are two words, should I use []?

Thanks,
Carmen



All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com