Access 2007 Form - sqlserver2000

  • Thread starter Thread starter Raoul
  • Start date Start date
R

Raoul

Hi everybody,

I am using Access 2007 and i am trying to connect to sql server 2000 from a
form in access 2007. I havent done this before, after some search i tried
this code, can you advise me if it is correct:


Dim connsql1 As String
connsql1 = "test"

Dim connection1 As SqlClient.SqlConnection

connection1 = SqlClient.SqlConnection("Data Source=ServerName;Initial
Catalog=DatabaseName;User Id=sa;Password=sa")

Dim myCMD As SqlCommand
myCMD = "select count(n0_period_no) from plu"
Text1.Text = myCMD


First of all i want to get an input from the program that the connection
succeded, that is why i run this query and i want to display the result in
the textox...


Any ideas are really appreciated,

Thanks in advance,
Best Regards
 
The commonly accepted means of connecting to a back end is to create links to
the tables in the backend database. Once the tables are linked, then the
form's recordset is set to the table name or a query based on the table.

Access handles all of the connections issues. It is not like ASP.NET.

http://office.microsoft.com/en-us/access/HA102004941033.aspx
http://office.microsoft.com/en-us/access/HA010345991033.asp
http://www.sqlservercentral.com/art...pgrading/accesstosqlserverlinkingtables/1722/
 
Back
Top