seeDBChanges and Too few Parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikD
    New Member
    • May 2009
    • 4

    #1

    seeDBChanges and Too few Parameters

    Hi I have one table which I upsized to SQL Server 2005 from access. Everything seems to work fine when I use "dbOpenDyna set, [dbSeeChanges]" when needed for tbl_Clients (the table on SQL Server) but this I can't seem to make work....

    sql = "SELECT tbl_Users.sFirs tname as sFN, tbl_Users.sLast name, tbl_Artists.lng ClientNumber as sLN, tbl_Clients.sEm ail as sE, * "
    sql = sql & "FROM tbl_Users RIGHT JOIN tbl_Clients ON tbl_Users.lngUs erID = tbl_Clients.lng UserID "

    If chkUnsubscribe = 1 Then
    sql = sql & "WHERE tbl_Clients.bUn subscribe= 0 "
    End If


    Set rsSource = db.OpenRecordse t((sql), dbOpenDynaset, dbSeeChanges)

    Any ideas??
    Thanks in advance
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You have * in there but you didn't qualify which table to get all fields from.

    Comment

    • munkee
      Contributor
      • Feb 2010
      • 374

      #3
      You are also using "sql" as a variable which is a reserved word. If it hasn't caused issues yet then it will likely in the future use something like strSql instead.

      Comment

      • vikD
        New Member
        • May 2009
        • 4

        #4
        Hmmm no dice I changed it and still the same too few parameters....

        strsql = "SELECT tbl_Users.sFirs tname as sFN, tbl_Users.sLast name, tbl_Artists.lng ClientNumber as sLN, tbl_Clients.sEm ail as sE, tbl_Clients.* "
        strsql = strsql & "FROM tbl_Users RIGHT JOIN tbl_Clients ON tbl_Users.lngUs erID = tbl_Clients.lng UserID "


        If chkUnsubscribe = 1 Then
        strsql = strsql & "WHERE tbl_Clients.bUn subscribe= 0 "
        End If


        Set rsSource = db.OpenRecordse t((strsql), dbOpenDynaset, dbSeeChanges)

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Does that SQL string work outside of code?

          Comment

          • vikD
            New Member
            • May 2009
            • 4

            #6
            Ohhh I'm an idiot. I inherited this code and it used to work until I upsized. After looking at the SQL it was messed up to begin with. The seeDBChanges was the solution.

            Guess the moral is don't assume just because it works it's correct.

            Thanks All!!

            Comment

            Working...