ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MS Access Query (https://www.excelbanter.com/excel-programming/330162-ms-access-query.html)

Purnima

MS Access Query
 
Hi,
I have a userform in Excel where I input a name and when I click on a
command button it should pull data corresponding to the name in the TextBox
and display it as a caption on some labels.
For e.g.
If I input name ABC in the textbox, I want to pull ABC's address from the
access database and display it on the corresponding label on the userform.

I have the following query:
"SELECT [Address] FROM ex_table WHERE [Analyst]= UserForm1.txtname.Text'"

But it does not work.

Can someone help with the code?

Thanx.




Harald Staff

MS Access Query
 
Hi Thanx

Try
"SELECT [Address] FROM ex_table WHERE [Analyst]='" & UserForm1.txtname.Text
& "'"

HTH. Best wishes Harald

"Purnima" skrev i melding
...
Hi,
I have a userform in Excel where I input a name and when I click on a
command button it should pull data corresponding to the name in the

TextBox
and display it as a caption on some labels.
For e.g.
If I input name ABC in the textbox, I want to pull ABC's address from the
access database and display it on the corresponding label on the userform.

I have the following query:
"SELECT [Address] FROM ex_table WHERE [Analyst]= UserForm1.txtname.Text'"

But it does not work.

Can someone help with the code?

Thanx.







All times are GMT +1. The time now is 02:04 PM.

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