Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Querying information on an Access Form

Author  Topic 

pralfer
Starting Member

3 Posts

Posted - 2010-08-03 : 10:09:47
I have experience with Access, but needed to make something more robust this time around. So I decided to try SQL Server as a backend to an Access ADP. So I have a form in Access and a query that runs off of of information in two text boxes on that form (more or less a login, although once I get the basics down, it will be expanded to bring up more relevant information). My script works fine in Access SQL, and it made what I thought were the necessary changes to make it T-SQL syntax compliant, but, alas, it does not work.

SELECT dbo.Employees.LastName, dbo.Employees.FirstName, dbo.Employees.LogInID, dbo.Employees.Password
FROM dbo.Employees
WHERE (((dbo.Employees.LogInID)=[Forms]![Login]![LoginID]) AND ((dbo.Employees.Password)=[Forms]![Login]![txtPassword]));


Any suggestion as to what I'm doing wrong would be helpful. I'm taking a class this fall dealing with SQL Server, but unfortuately, I need this mostly done before then.

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-08-03 : 11:08:53
1. What error do you get, please post the error in order for us to help you better.
2. are you using Access ADP or Access mdb?
3. Have created your links to your tables such as Employees?
4. Now that you are using the power of SQL, why use inline SQL? Why not use stored procedures via adodb?

If you don't have the passion to help people, you have no passion
Go to Top of Page

pralfer
Starting Member

3 Posts

Posted - 2010-08-03 : 12:44:26
Thank you for the reply and the help.
1) The error I get is:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '!'.

2) It's an Access ADP

3) I have my tables linked.

4) Mostly because I had to Google to figure out what you are talking about, and the next short answer is because I assume I'd have to learn either Python or PHP, and I have experience with neither. Just enough Java and VBA to not embarress myself, and a touch of C#.
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-08-03 : 13:53:27
I would write a stored procedure on sql server then pass in )=[Forms]![Login]![LoginID]) and [Forms]![Login]![txtPassword])) as parameters


If you don't have the passion to help people, you have no passion
Go to Top of Page

pralfer
Starting Member

3 Posts

Posted - 2010-08-03 : 16:29:04
I will look it doing that! Thank you very much!
Go to Top of Page
   

- Advertisement -