Connecting to SQL Server DB on web server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • budgetedi@googlemail.com

    Connecting to SQL Server DB on web server

    I'm trying to get Access 2003 to connect to Microsft SQL Server on a
    web server.

    I can open the linked table without any problem, but whenever I run the
    code on my form, it returns this error: Datatyle mismatch in the query
    expression.

    Heres the Microsfot SQL Server details...

    server: mssql.pipeten.c om
    username: budgete_kingsga te
    password: thehub
    database: budgete_kingsga te


    And heres the code...

    'open recordset
    Dim CurrentUserCoun t As Integer
    Dim CurrentUser As DAO.Recordset
    Set db = CurrentDb
    Set CurrentUser = db.OpenRecordse t("SELECT * FROM Users " & _
    "WHERE Users.Mobile_No ='" & Cleanest_Mobile & "' AND
    Users.PIN='" & txt_PIN & "'; ")


    It's simply putting the content of an SQL query into a recordset.
    thats not even hard. so can anyone understand why it isn't working?

    Cheers
    Phil.

  • Mike Preston

    #2
    Re: Connecting to SQL Server DB on web server

    On 2 Apr 2006 01:29:13 -0800, budgetedi@googl email.com wrote:
    [color=blue]
    >I'm trying to get Access 2003 to connect to Microsft SQL Server on a
    >web server.
    >
    >I can open the linked table without any problem, but whenever I run the
    >code on my form, it returns this error: Datatyle mismatch in the query
    >expression.
    >
    >Heres the Microsfot SQL Server details...
    >
    > server: mssql.pipeten.c om
    > username: budgete_kingsga te
    > password: thehub
    > database: budgete_kingsga te
    >
    >
    >And heres the code...
    >
    > 'open recordset
    > Dim CurrentUserCoun t As Integer
    > Dim CurrentUser As DAO.Recordset
    > Set db = CurrentDb
    > Set CurrentUser = db.OpenRecordse t("SELECT * FROM Users " & _
    > "WHERE Users.Mobile_No ='" & Cleanest_Mobile & "' AND
    >Users.PIN='" & txt_PIN & "'; ")[/color]

    Try the following:

    Set CurrentUser = db.OpenRecordse t("SELECT * FROM Users " & _
    "WHERE Users.Mobile_No =" & Cleanest_Mobile & " AND & _
    Users.PIN='" & txt_PIN & "'; ")

    mike

    Comment

    Working...