Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Microsoft Query

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Microsoft Query

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Microsoft Query

JackeyC,

Thanks for your help. I tried your code, and I got this error message
"Incorrect syntax near ']'. Statement[s] could not be prepared.".

If I then change my code to [Field]![A]+"."+[Field]![b], I would receive
this error message,

SQL Query can't be represented graphically. Continue anyway?

If I click OK on it, I would then receive this error message,

Incorrect column expression: '['

Thanks again.

"JakeyC" wrote:

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Microsoft Query

It would help me if you posted the exact query. I'm a bit confused as
to why you're using the [] and ! in it?


Please Help wrote:
JackeyC,

Thanks for your help. I tried your code, and I got this error message
"Incorrect syntax near ']'. Statement[s] could not be prepared.".

If I then change my code to [Field]![A]+"."+[Field]![b], I would receive
this error message,

SQL Query can't be represented graphically. Continue anyway?

If I click OK on it, I would then receive this error message,

Incorrect column expression: '['

Thanks again.

"JakeyC" wrote:

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Microsoft Query

Good morning JakeyC,

Thanks again for your help. I took a different approach by creating a query
in Access and linking that query to the Excel via Microsoft Query. I think
Microsoft Query has more limitations than Access on what you can do.

Anyhow, I do have one more question. How do I protect my Microsoft Query
from the users going in and messing things up? I have a protection on the
workbook "Structure". However, if the user has an External Data toolbar,
they can click on the Edit Query button to go into the query.

Thanks again.

"JakeyC" wrote:

It would help me if you posted the exact query. I'm a bit confused as
to why you're using the [] and ! in it?


Please Help wrote:
JackeyC,

Thanks for your help. I tried your code, and I got this error message
"Incorrect syntax near ']'. Statement[s] could not be prepared.".

If I then change my code to [Field]![A]+"."+[Field]![b], I would receive
this error message,

SQL Query can't be represented graphically. Continue anyway?

If I click OK on it, I would then receive this error message,

Incorrect column expression: '['

Thanks again.

"JakeyC" wrote:

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Microsoft Query

You can either password-protect the database you connect to, or protect
the sheet and lock the cell that contains the query.


Please Help wrote:
Good morning JakeyC,

Thanks again for your help. I took a different approach by creating a query
in Access and linking that query to the Excel via Microsoft Query. I think
Microsoft Query has more limitations than Access on what you can do.

Anyhow, I do have one more question. How do I protect my Microsoft Query
from the users going in and messing things up? I have a protection on the
workbook "Structure". However, if the user has an External Data toolbar,
they can click on the Edit Query button to go into the query.

Thanks again.

"JakeyC" wrote:

It would help me if you posted the exact query. I'm a bit confused as
to why you're using the [] and ! in it?


Please Help wrote:
JackeyC,

Thanks for your help. I tried your code, and I got this error message
"Incorrect syntax near ']'. Statement[s] could not be prepared.".

If I then change my code to [Field]![A]+"."+[Field]![b], I would receive
this error message,

SQL Query can't be represented graphically. Continue anyway?

If I click OK on it, I would then receive this error message,

Incorrect column expression: '['

Thanks again.

"JakeyC" wrote:

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Microsoft Query

JakeyC,

Thanks again for your help. It works when I password-protect the Access
database.

You might have noticed. I posted the same message this morning titled
"Protecting a Microsoft Query". Since I got my answer, please do not respond
to it.

Thanks.

"JakeyC" wrote:

You can either password-protect the database you connect to, or protect
the sheet and lock the cell that contains the query.


Please Help wrote:
Good morning JakeyC,

Thanks again for your help. I took a different approach by creating a query
in Access and linking that query to the Excel via Microsoft Query. I think
Microsoft Query has more limitations than Access on what you can do.

Anyhow, I do have one more question. How do I protect my Microsoft Query
from the users going in and messing things up? I have a protection on the
workbook "Structure". However, if the user has an External Data toolbar,
they can click on the Edit Query button to go into the query.

Thanks again.

"JakeyC" wrote:

It would help me if you posted the exact query. I'm a bit confused as
to why you're using the [] and ! in it?


Please Help wrote:
JackeyC,

Thanks for your help. I tried your code, and I got this error message
"Incorrect syntax near ']'. Statement[s] could not be prepared.".

If I then change my code to [Field]![A]+"."+[Field]![b], I would receive
this error message,

SQL Query can't be represented graphically. Continue anyway?

If I click OK on it, I would then receive this error message,

Incorrect column expression: '['

Thanks again.

"JakeyC" wrote:

If your Query was originally:

SELECT a.first_name, a.surname
FROM example.dbo.a

then to create a third column combining both names (Full_Name), you
would use:

SELECT a.first_name, a.surname,
a.first_name+' '+a.surname AS 'Full_Name'
FROM example.dbo.a

Hope this helps.


Please Help wrote:

I use Microsoft Query to connect and to bring in the information from a
database in a SQL server. I have no problem bring the info in. However, I
have a problem creating a custom field.

For example, I have Fields (Columns) A and B. I want to create Field C that
combines the values from Fields A and B. In Access, I can create a Field C
by writing this expression in a query:

Field C: Field A & Field B

I tried to write a similar expression, and it does not recognize it. Please
help.

Thanks.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query from microsoft query- Excel 2007 טבלאות אקסל 2007 Excel Discussion (Misc queries) 0 December 24th 07 10:47 PM
Microsoft Query VNCNTJ Excel Worksheet Functions 1 June 28th 05 09:11 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
Microsoft Query gsteck Excel Programming 5 March 25th 05 08:35 PM
Using Microsoft Query Paul Johnson[_2_] Excel Programming 1 February 22nd 05 08:52 AM


All times are GMT +1. The time now is 01:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"