By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,155 Members | 2,563 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,155 IT Pros & Developers. It's quick & easy.

Select ... From

P: 36
I still new to SQL think and trying to learn but its not easy

I have a table called table2, it has 2 fields user and password. In a form I have a textbox that will contain input

I want to do search on this table to find if user exist or not
How can I do that?

I tried
SELECT user FROM table WHERE box.value=user

but get error on 'user' saying expected: Case
Dec 3 '06 #1
Share this Question
Share on Google+
2 Replies


blyxx86
100+
P: 256
I still new to SQL think and trying to learn but its not easy

I have a table called table2, it has 2 fields user and password. In a form I have a textbox that will contain input

I want to do search on this table to find if user exist or not
How can I do that?

I tried
SELECT user FROM table WHERE box.value=user

but get error on 'user' saying expected: Case
Try...
Expand|Select|Wrap|Line Numbers
  1. SELECT table2.User FROM table2 WHERE (((table2.[User])=[Forms]![frmName]![textbox]));
  2.  
Dec 3 '06 #2

NeoPa
Expert Mod 15k+
P: 31,616
If you're getting the message 'Expected Case' then you are entering SQL code into VBA.
You need to run
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL strSQL
after you've set up the VBA String strSQL to be your SQL string. There are various examples of these here in TheScripts.
If you can't find anything or you need more help then come back and let us know.
Perhaps I should explain about the Case bit :
In VBA you have a Select Case statement which allows you to do some complicated If like processing.
If the compiler is expecting Case after the Select bit, then you must have tried to execute it directly from within VBA rather than pass it to the SQL interpreter.
Dec 3 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.