473,394 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to query a MSSQL Server database using ODBC Access?

Hello everybody;

First of all, I'm a newby in generating SQL code. I'm trying to generate a query on a MSSQL database using Access 2007. I need to query a table on a DATE/TIME field. The problem is that the TIME part is not needed and I kinda would like to make a parameter-query where the users just need to enter the parameter a date (FORMAT dd/mm/YYYY). I'm living in Europe, Belgium to be more specific.

It should go something like this :
SELECT *
FROM dbo.tbl.InArch
WHERE dbo.tbl_InArchDate = #dd-mm-yyyy# Result : none.....

Does anyone see's the problem, I'm not..

Thank you for you kind suppport, it's very much appreciated.
Dec 18 '10 #1
1 2158
colintis
255 100+
A suggestion would be make a linked table from the SQL server and work your query with it to extract data.

For example, you have created a linked table from the server and it named tbl_InArch. Then in your query it will be this without dbo.
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM tbl_InArch
  3. WHERE tbl_InArchDate = #<the dates># 
Then for the date parameter, if you are running the query directly, you should be replace a field instead, so it would be something like this:
Expand|Select|Wrap|Line Numbers
  1. WHERE tbl_InArchDate = [Date]
If you are implementing through VBA, this is what most likely you are doing:
Expand|Select|Wrap|Line Numbers
  1. Dim InputDate As DateTime 'This is your date input from somewhere in the form
  2.  
  3. Dim strSQL As String
  4. strSQL = "SELECT * FROM tbl_InArch WHERE tbl_InArch = #" & Format(InputDate, "mm/dd/yyyy") & "#"
A further explain, the format mm/dd/yyyy is SQL's standard date format, and the format function will do the work to change the date format from user input.

Finally, I also notice that the naming of tbl_InArchDate is a bit weired, just make sure it is a part of the field within the table tbl_InArchDate.
Dec 21 '10 #2

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

Similar topics

3
by: Bose | last post by:
Hi I have to make export of SQL Server Database to MS Access and I have done it with the tables but now I need to transfer(export) the relations, keys and indexes. Can any1 tell me how to read...
1
by: Universal | last post by:
store Images (or any Binary Data) to a SQL Server database using VC++ Can anybody help me in this Thanks in advance
0
by: Santhosh.A.N | last post by:
Hi, I have a problem to be solved yet. Following is the problem: I have a MSProject saved in SQLServer using ODBC, which automatically generates tables relevant to data. My requirement is to open...
2
by: somersbar | last post by:
im trying to get a basic ASP.NET application running. im trying to display data from a microsoft access database on my web form. im trying to bind the data to a data-grid. but i get the following...
1
by: shun | last post by:
Hello, I need an sample program to connect mysql server by using odbc. thanks in advance
3
by: Suresh P | last post by:
Hi All, I tried to access the mysql database in ODBC using ip address and username/password. It returns, "cannot connect to MySQL server on IP ADDRESS(10060)". This could be related to Firewall...
1
by: sanghamitra das | last post by:
I want to transfer some xml documents to sql server database using asp.net.
0
by: sarvjit | last post by:
hi i'm developing web app, in which i'm trying to use remote database but files are on my local system. ihave already mention the IP of remote data base in globel and web configuration files but...
6
by: Mark | last post by:
Currently using MS Access 2000 and SQL Server Express. Using the current DAO OpenRecordset code listed below, however I keep getting the error message.... 3254: ODBC --Cannot lock all records ...
5
by: ofiras | last post by:
Hi everyone, As far as I know, you cannot connect directly to a SQL Server database from a web browser application because of the security restrictions. Is there any other way to connect to a SQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.