Results 1 to 32 of 32

Thread: [RESOLVED] Can somebody PLEASE help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Resolved [RESOLVED] Can somebody PLEASE help

    Hello,

    I have the following query that is giving me error:

    Microsoft JET Database Engine
    -2147217900 Syntax error in UPDATE statement.

    UPDATE Employees SET First_name = "Faaez", Last_name = "Kamaal", Middle = 'A', Address = "5835 S. Blucher Drive", City = "Tucson", State = 'AZ', Zip = '85746', Phone = '5207417099', Alt_phone = '5207410715', Type = 'S', User_id = 'FAAEZ', Password = '123456', Status = 'W', Commission_p = 50, Commission_f = 100, Commission_m = 250, DLN = 'D12345678', DL_state = 'AZ', DL_exp = '7/1/2006', SSN = '000000000', Notes = "This is a test.", Start_date = '7/1/2006', End_date = '7/1/2006', Salary_chk = 0, Comn_chk = 1, M_salary = 0 WHERE Emp_id = 1

    I do not understand the error. Waisted half a day but enable to find any errors. When I paste this same thing in VISDATA it works just fine without errors but thru my application it is coming up with this error.

    some dat has single quote arround it and some has double quotes. It is only because I am expecting an apostrophy s in that field. And ofcourse numbers are without any quotes arround them.

    Any and all help will be greatly appreciated.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    What type of database is this ?
    And are the date strings going in Date Fields or Text Fields ?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    It is MS Access and this is my connection string:

    Set cn = New ADODB.Connection 'weve declared it as a ADODB connection lets set it.
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source= " & App.Path & "\Vehicle_sales.mdb" 'this is the connection string.
    cn.Open

    Call cn.Execute(sSQL)

    cn.Close
    Set cn = Nothing

    Dates are going into date fields for sure cuz it isa working fine in the VISDATA so must be right. Only thru the application it is coming up with this error.

    Also if the data type is wrong the there will not be a syntax error I think.

  4. #4
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    Did you try the date fields like this ..

    #01/06/2006#

    When working with a date in Access always use the # in your SQL statement.

    eg.
    SQL="INSERT INTO myTable (myDateFld) VALUES (#" & FormatDateTime(Date, 2) & "#)"
    Last edited by rory; Jul 1st, 2006 at 11:47 PM.

  5. #5
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    also,use single quotes on the Text Fields.

    Replace the fields before or when you enter them by using a function like this ..

    VB Code:
    1. '// CLEAN DATABASE TEXT STRING
    2. Public Function Correct_String(ByVal rStr As String)
    3.     Correct_String = Replace$(rStr, "'", "''")
    4. End Function

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rory,

    Thanks for your quick response. I tried what you have suggested but still same error

  7. #7
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    did you update it without the single colon on the date field ..?

    Eg . ,, with Corrected Text and Date Fields ..

    UPDATE Employees SET First_name = 'Faaez', Last_name = 'Kamaal', Middle = 'A', Address = '5835 S. Blucher Drive', City = 'Tucson', State = 'AZ', Zip = '85746', Phone = '5207417099', Alt_phone = '5207410715', Type = 'S', User_id = 'FAAEZ', Password = '123456', Status = 'W', Commission_p = 50, Commission_f = 100, Commission_m = 250, DLN = 'D12345678', DL_state = 'AZ', DL_exp = #7/1/2006#, SSN = '000000000', Notes = 'This is a test.', Start_date = #7/1/2006#, End_date = #7/1/2006#, Salary_chk = 0, Comn_chk = 1, M_salary = 0 WHERE Emp_id = 1

    Also when i copied and pasted your SQL I got a Double Quote instead of 2 single quotes .. which will probably give an error.

    Edit: missed another date field.

    Also is SSN a Text Field?
    Last edited by rory; Jul 1st, 2006 at 11:57 PM.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rory,

    I tried single quotes and Chr(34) which is a double quote but no difference. Yes the SSN is a text field.

    What I am puzzled about is that this same query is working just fine in the VISDATA.exe which is the interface to MS Access thru VB6.

    I am so fruastrated now. I have a huge application and this is the first time this SIMPLE UPDATE is coming up with so hiden type of error.

    I really do appreciate all your help.

  9. #9
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    can you PM me the Access DB and Ill check it out ..
    Thanks
    Rory

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Can you please tell me how to PM you the DB? I don't know how to do it.

    Thanks.

  11. #11
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Can somebody PLEASE help

    Have a look at the highlighted (yellow), change yellow to single quotes
    Then the dates need to be surrounded by #

    Quote Originally Posted by Newtester
    Hello,

    I have the following query that is giving me error:

    Microsoft JET Database Engine
    -2147217900 Syntax error in UPDATE statement.

    UPDATE Employees SET First_name = "Faaez", Last_name = "Kamaal", Middle = 'A', Address = "5835 S. Blucher Drive", City = "Tucson", State = 'AZ', Zip = '85746', Phone = '5207417099', Alt_phone = '5207410715', Type = 'S', User_id = 'FAAEZ', Password = '123456', Status = 'W', Commission_p = 50, Commission_f = 100, Commission_m = 250, DLN = 'D12345678', DL_state = 'AZ', DL_exp = '#7/1/2006#', SSN = '000000000', Notes = "This is a test.", Start_date = '#7/1/2006#', End_date = '#7/1/2006#', Salary_chk = 0, Comn_chk = 1, M_salary = 0 WHERE Emp_id = 1

    I do not understand the error. Waisted half a day but enable to find any errors. When I paste this same thing in VISDATA it works just fine without errors but thru my application it is coming up with this error.

    some dat has single quote arround it and some has double quotes. It is only because I am expecting an apostrophy s in that field. And ofcourse numbers are without any quotes arround them.

    Any and all help will be greatly appreciated.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    BrailleSchool,

    Thanks for your help but I have tried that already still getting the same error.

  13. #13
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    sent you a PM

  14. #14
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Can somebody PLEASE help

    What I would do is make it easier to read the SQL statement because its kinda long, do it like so:
    VB Code:
    1. Dim sSQL As String
    2.  
    3. sSQL = "UPDATE Employees "
    4. sSQL = sSQL & "SET First_name = 'Faaez', "
    5. sSQL = sSQL & "Last_name = 'Kamaal', "
    6. sSQL = sSQL & "Middle = 'A', "
    7. sSQL = sSQL & "Address = '5835 S. Blucher Drive', "
    8. sSQL = sSQL & "City = 'Tucson', "
    9. sSQL = sSQL & "State = 'AZ', "
    10. sSQL = sSQL & "Zip = '85746', "
    11. sSQL = sSQL & "Phone = '5207417099', "
    12. sSQL = sSQL & "Alt_phone = '5207410715', "
    13. sSQL = sSQL & "Type = 'S', "
    14. sSQL = sSQL & "User_id = 'FAAEZ', "
    15. sSQL = sSQL & "Password = '123456', "
    16. sSQL = sSQL & "Status = 'W', "
    17. sSQL = sSQL & "Commission_p = 50, "
    18. sSQL = sSQL & "Commission_f = 100, "
    19. sSQL = sSQL & "Commission_m = 250, "
    20. sSQL = sSQL & "DLN = 'D12345678', "
    21. sSQL = sSQL & "DL_state = 'AZ', "
    22. sSQL = sSQL & "DL_exp = '#7/1/2006#', "
    23. sSQL = sSQL & "SSN = '000000000', "
    24. sSQL = sSQL & "Notes = 'This is a test.', "
    25. sSQL = sSQL & "Start_date = '#7/1/2006#', "
    26. sSQL = sSQL & "End_date = '#7/1/2006#', "
    27. sSQL = sSQL & "Salary_chk = 0, "
    28. sSQL = sSQL & "Comn_chk = 1, "
    29. sSQL = sSQL & "M_salary = 0 "
    30. sSQL = sSQL & "WHERE Emp_id = 1"
    I just put the above code into a code window (command click) and I get no errors for syntax problems

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    These are the routine I am using:

    VB Code:
    1. Private Sub Set_tf(ByRef Ta() As String)
    2.    Ta(0) = "'" & Trim$(TBx(1).Text) & "'"
    3.    Ta(1) = "'" & Trim$(TBx(0).Text) & "'"
    4.    Ta(2) = "'" & Trim$(TBx(2).Text) & "'"
    5.    Ta(3) = "'" & Trim$(TBx(3).Text) & "'"
    6.    Ta(4) = "'" & Trim$(TBx(4).Text) & "'"
    7.    Ta(5) = "'" & Trim$(TBx(5).Text) & "'"
    8.    Ta(6) = "'" & Trim$(TBx(6).Text) & "'"
    9.    Ta(7) = "'" & Trim$(MBx(0).Text) & "'"
    10.    Ta(8) = "'" & Trim$(MBx(1).Text) & "'"
    11.    Ta(9) = "'" & Left$(Combo(0).Text, 1) & "'"
    12.    Ta(10) = "'" & Trim$(TBx(9).Text) & "'"
    13.    Ta(11) = "'" & Trim$(TBx(10).Text) & "'"
    14.    Ta(12) = "'" & Left$(Combo(1).Text, 1) & "'"
    15.    Ta(13) = Val(TBx(12).Text)
    16.    Ta(14) = Val(TBx(13).Text)
    17.    Ta(15) = Val(TBx(14).Text)
    18.    Ta(16) = "'" & Trim$(TBx(7).Text) & "'"
    19.    Ta(17) = "'" & Trim$(TBx(8).Text) & "'"
    20.    Ta(18) = "'#" & DTPik(0).Value & "#'"
    21.    Ta(19) = "'" & Trim$(MBx(2).Text) & "'"
    22.    Ta(20) = "'" & Trim$(RTBx.Text) & "'"
    23.    Ta(21) = "'#" & DTPik(1).Value & "#'"
    24.    Ta(22) = "'#" & DTPik(2).Value & "#'"
    25.    Ta(23) = Chk(0).Value
    26.    Ta(24) = Chk(1).Value
    27.    Ta(25) = Val(TBx(11).Text)
    28. End Sub
    29.  
    30. Private Sub Update_employee()
    31.    On Error GoTo DispError
    32.    
    33.    Dim sSQL As String, cn As ADODB.Connection, I As Integer, Tf(25) As String
    34.    
    35.    Me.MousePointer = 11
    36.    
    37.    Call Set_tf(Tf())
    38.    
    39.    sSQL = "UPDATE Employees SET "
    40.    sSQL = sSQL & "First_name = " & Tf(0) & ", "
    41.    sSQL = sSQL & "Last_name = " & Tf(1) & ", "
    42.    sSQL = sSQL & "Middle = " & Tf(2) & ", "
    43.    sSQL = sSQL & "Address = " & Tf(3) & ", "
    44.    sSQL = sSQL & "City = " & Tf(4) & ", "
    45.    sSQL = sSQL & "State = " & Tf(5) & ", "
    46.    sSQL = sSQL & "Zip = " & Tf(6) & ", "
    47.    sSQL = sSQL & "Phone = " & Tf(7) & ", "
    48.    sSQL = sSQL & "Alt_phone = " & Tf(8) & ", "
    49.    sSQL = sSQL & "Type = " & Tf(9) & ", "
    50.    sSQL = sSQL & "User_id = " & Tf(10) & ", "
    51.    sSQL = sSQL & "Password = " & Tf(11) & ", "
    52.    sSQL = sSQL & "Status = " & Tf(12) & ", "
    53.    sSQL = sSQL & "Commission_p = " & Tf(13) & ", "
    54.    sSQL = sSQL & "Commission_f = " & Tf(14) & ", "
    55.    sSQL = sSQL & "Commission_m = " & Tf(15) & ", "
    56.    sSQL = sSQL & "DLN = " & Tf(16) & ", "
    57.    sSQL = sSQL & "DL_state = " & Tf(17) & ", "
    58.    sSQL = sSQL & "DL_exp = " & Tf(18) & ", "
    59.    sSQL = sSQL & "SSN = " & Tf(19) & ", "
    60.    sSQL = sSQL & "Notes = " & Tf(20) & ", "
    61.    sSQL = sSQL & "Start_date = " & Tf(21) & ", "
    62.    sSQL = sSQL & "End_date = " & Tf(22) & ", "
    63.    sSQL = sSQL & "Salary_chk = " & Tf(23) & ", "
    64.    sSQL = sSQL & "Comn_chk = " & Tf(24) & ", "
    65.    sSQL = sSQL & "M_salary = " & Tf(25) & " "
    66.    sSQL = sSQL & "WHERE Emp_id = " & Val(Lbl1.Caption)
    67.  
    68.    Set cn = New ADODB.Connection 'weve declared it as a ADODB connection lets set it.
    69.    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    70.       "Data Source= " & App.Path & "\Vehicle_sales.mdb" 'this is the connection string.
    71.    cn.Open
    72.  
    73.    Call cn.Execute(sSQL)
    74.    
    75.    cn.Close
    76.    Set cn = Nothing
    77.    
    78.    Me.MousePointer = 0
    79.    Exit Sub
    80.    
    81. DispError:
    82.    Call ShowError(sSQL, "ADEEmployeeP1", "Update_employee", Err.Number, Err.Description, Err.Source)
    83.    Me.MousePointer = 0
    84.    cn.Close
    85.    Set cn = Nothing
    86. End Sub

    and here is the error I am getting back:

    Microsoft JET Database Engine
    -2147217900 Syntax error in UPDATE statement.

    UPDATE Employees SET First_name = 'Faaez', Last_name = 'Kamaal', Middle = 'A', Address = '5835 S. Blucher Drive', City = 'Tucson', State = 'AZ', Zip = '85746', Phone = '5207417099', Alt_phone = '5207410715', Type = 'S', User_id = 'FAAEZ', Password = '123456', Status = 'W', Commission_p = 50, Commission_f = 100, Commission_m = 250, DLN = 'D12345678', DL_state = 'AZ', DL_exp = '#7/1/2006#', SSN = '000000000', Notes = 'This is a test.', Start_date = '#7/1/2006#', End_date = '#7/1/2006#', Salary_chk = 0, Comn_chk = 1, M_salary = 0 WHERE Emp_id = 1

  16. #16
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Can somebody PLEASE help

    VB Code:
    1. sSQL = "UPDATE Employees SET "
    2.    sSQL = sSQL & "First_name = [hl]'[/hl]" & Tf(0) & "[hl]'[/hl], "
    3.    sSQL = sSQL & "Last_name = [hl]'[/hl]" & Tf(1) & "[hl]'[/hl], "
    4.    sSQL = sSQL & "Middle = [hl]'[/hl]" & Tf(2) & "[hl]'[/hl], "
    5.    sSQL = sSQL & "Address = [hl]'[/hl]" & Tf(3) & "[hl]'[/hl], "
    6.    sSQL = sSQL & "City = [hl]'[/hl]" & Tf(4) & "[hl]'[/hl], "
    7.    sSQL = sSQL & "State = [hl]'[/hl]" & Tf(5) & "[hl]'[/hl], "
    8.    sSQL = sSQL & "Zip = [hl]'[/hl]" & Tf(6) & "[hl]'[/hl], "
    9.    sSQL = sSQL & "Phone = [hl]'[/hl]" & Tf(7) & "[hl]'[/hl], "
    10.    sSQL = sSQL & "Alt_phone = [hl]'[/hl]" & Tf(8) & "[hl]'[/hl], "
    11.    sSQL = sSQL & "Type = [hl]'[/hl]" & Tf(9) & "[hl]'[/hl], "
    12.    sSQL = sSQL & "User_id = [hl]'[/hl]" & Tf(10) & "[hl]'[/hl], "
    13.    sSQL = sSQL & "Password = [hl]'[/hl]" & Tf(11) & "[hl]'[/hl], "
    14.    sSQL = sSQL & "Status = [hl]'[/hl]" & Tf(12) & "[hl]'[/hl], "
    15.    sSQL = sSQL & "Commission_p = [hl]'[/hl]" & Tf(13) & "[hl]'[/hl], "
    16.    sSQL = sSQL & "Commission_f = [hl]'[/hl]" & Tf(14) & "[hl]'[/hl], "
    17.    sSQL = sSQL & "Commission_m = [hl]'[/hl]" & Tf(15) & "[hl]'[/hl], "
    18.    sSQL = sSQL & "DLN = [hl]'[/hl]" & Tf(16) & "[hl]'[/hl], "
    19.    sSQL = sSQL & "DL_state = [hl]'[/hl]" & Tf(17) & "[hl]'[/hl], "
    20.    sSQL = sSQL & "DL_exp = [hl]'[/hl]" & Tf(18) & "[hl]'[/hl], "
    21.    sSQL = sSQL & "SSN = [hl]'[/hl]" & Tf(19) & "[hl]'[/hl], "
    22.    sSQL = sSQL & "Notes = [hl]'[/hl]" & Tf(20) & "[hl]'[/hl], "
    23.    sSQL = sSQL & "Start_date = [hl]'[/hl]" & Tf(21) & "[hl]'[/hl], "
    24.    sSQL = sSQL & "End_date = [hl]'[/hl]" & Tf(22) & "[hl]'[/hl], "
    25.    sSQL = sSQL & "Salary_chk = [hl]'[/hl]" & Tf(23) & "[hl]'[/hl], "
    26.    sSQL = sSQL & "Comn_chk = [hl]'[/hl]" & Tf(24) & "[hl]'[/hl], "
    27.    sSQL = sSQL & "M_salary = [hl]'[/hl]" & Tf(25) & "[hl]'[/hl] "
    28.    sSQL = sSQL & "WHERE Emp_id = " & Val(Lbl1.Caption)

  17. #17
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    get rid of single quotes around date ..

    VB Code:
    1. Private Sub Set_tf(ByRef Ta() As String)
    2.    Ta(0) = "'" & Trim$(TBx(1).Text) & "'"
    3.    Ta(1) = "'" & Trim$(TBx(0).Text) & "'"
    4.    Ta(2) = "'" & Trim$(TBx(2).Text) & "'"
    5.    Ta(3) = "'" & Trim$(TBx(3).Text) & "'"
    6.    Ta(4) = "'" & Trim$(TBx(4).Text) & "'"
    7.    Ta(5) = "'" & Trim$(TBx(5).Text) & "'"
    8.    Ta(6) = "'" & Trim$(TBx(6).Text) & "'"
    9.    Ta(7) = "'" & Trim$(MBx(0).Text) & "'"
    10.    Ta(8) = "'" & Trim$(MBx(1).Text) & "'"
    11.    Ta(9) = "'" & Left$(Combo(0).Text, 1) & "'"
    12.    Ta(10) = "'" & Trim$(TBx(9).Text) & "'"
    13.    Ta(11) = "'" & Trim$(TBx(10).Text) & "'"
    14.    Ta(12) = "'" & Left$(Combo(1).Text, 1) & "'"
    15.    Ta(13) = Val(TBx(12).Text)
    16.    Ta(14) = Val(TBx(13).Text)
    17.    Ta(15) = Val(TBx(14).Text)
    18.    Ta(16) = "'" & Trim$(TBx(7).Text) & "'"
    19.    Ta(17) = "'" & Trim$(TBx(8).Text) & "'"
    20.    Ta(18) = "#" & DTPik(0).Value & "#"
    21.    Ta(19) = "'" & Trim$(MBx(2).Text) & "'"
    22.    Ta(20) = "'" & Trim$(RTBx.Text) & "'"
    23.    Ta(21) = "#" & DTPik(1).Value & "#"
    24.    Ta(22) = "#" & DTPik(2).Value & "#"
    25.    Ta(23) = Chk(0).Value
    26.    Ta(24) = Chk(1).Value
    27.    Ta(25) = Val(TBx(11).Text)
    28. End Sub

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rory,

    I just sent you an email with my DB.

  19. #19
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    Got it .. why is Comn_chk set to a byte format?
    The others are doubles also .. by default a number in Access is a Long Integer..
    This is an old version of Access BTW (Access 95) so i cant edit it .. :-(

  20. #20
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Can somebody PLEASE help

    how about this:
    VB Code:
    1. Dim sSQL As String
    2.  
    3.    sSQL = "UPDATE Employees SET "
    4.    sSQL = sSQL & "First_name = '" & Trim$(TBx(1).Text) & "', "
    5.    sSQL = sSQL & "Last_name = '" & Trim$(TBx(0).Text) & "', "
    6.    sSQL = sSQL & "Middle = '" & Trim$(TBx(2).Text) & "', "
    7.    sSQL = sSQL & "Address = '" & Trim$(TBx(3).Text) & "', "
    8.    sSQL = sSQL & "City = '" & Trim$(TBx(4).Text) & "', "
    9.    sSQL = sSQL & "State = '" & Trim$(TBx(5).Text) & "', "
    10.    sSQL = sSQL & "Zip = '" & Trim$(TBx(6).Text) & "', "
    11.    sSQL = sSQL & "Phone = '" & Trim$(MBx(0).Text) & "', "
    12.    sSQL = sSQL & "Alt_phone = '" & Trim$(MBx(1).Text) & "', "
    13.    sSQL = sSQL & "Type = '" & Left$(Combo(0).Text, 1) & "', "
    14.    sSQL = sSQL & "User_id = '" & Trim$(TBx(9).Text) & "', "
    15.    sSQL = sSQL & "Password = '" & Trim$(TBx(10).Text) & "', "
    16.    sSQL = sSQL & "Status = '" & Left$(Combo(1).Text, 1) & "', "
    17.    sSQL = sSQL & "Commission_p = '" & Val(TBx(12).Text) & "', "
    18.    sSQL = sSQL & "Commission_f = '" & Val(TBx(13).Text) & "', "
    19.    sSQL = sSQL & "Commission_m = '" & Val(TBx(14).Text) & "', "
    20.    sSQL = sSQL & "DLN = '" & Trim$(TBx(7).Text) & "', "
    21.    sSQL = sSQL & "DL_state = '" & Trim$(TBx(8).Text) & "', "
    22.    sSQL = sSQL & "DL_exp = " '#' & DTPik(0).Value & '#',
    23.    sSQL = sSQL & "SSN = '" & Trim$(MBx(2).Text) & "', "
    24.    sSQL = sSQL & "Notes = '" & Trim$(RTBx.Text) & "', "
    25.    sSQL = sSQL & "Start_date = " '#' & DTPik(1).Value & '#',
    26.    sSQL = sSQL & "End_date = " '#' & DTPik(2).Value & '#',
    27.    sSQL = sSQL & "Salary_chk = '" & Chk(0).Value & "', "
    28.    sSQL = sSQL & "Comn_chk = '" & Chk(1).Value & "', "
    29.    sSQL = sSQL & "M_salary = '" & Val(TBx(11).Text) & "' "
    30.    sSQL = sSQL & "WHERE Emp_id = " & Val(Lbl1.Caption)

  21. #21
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Can somebody PLEASE help

    Quote Originally Posted by rory
    Got it .. why is Comn_chk set to a byte format?
    The others are doubles also .. by default a number in Access is a Long Integer..
    This is an old version of Access BTW (Access 95) so i cant edit it .. :-(
    so it isnt his code but his db setup?

  22. #22

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rory,

    it is a BYTE cuz I will store only a 0 or a 1 in it so why declare it any other way? I am using thwe same format in other tables as well and it is working just fine in all other tables.

  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    BrailleSchool,

    I do not understand why you want me to put single quotes arround NUMERIC fields? I think it will definitely genrate an error.

  24. #24
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    Quote Originally Posted by BrailleSchool
    so it isnt his code but his db setup?
    Well i know with Access you 'should' use # around dates and no single quotes ... but also the DB is Access 95 .. plus the formats are bytes on one number field, and double on some others. ... if i edit the fields it would be in Office 2003 so he wouldnt be able to use it ... at least not manually .. though it may work in the application?

  25. #25

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rroy,

    When I installed VB6 Professional and created the DB this is the version it was there. I have OFFICE 2003 that includes the new version of MS ACCESS but I don't know how to upgrade my existing DB. ALso not sure if I upgrade it then my application will be able to access it or not?

  26. #26

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rroy,

    So you think it is the BYTE format that is causing this error? Cuz if you see some other tables they have the same BYTE format and working just fine thru the same application.

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    What ever the error is it is well hidden. Cuz the direct interface to the DB (Visdata.exe) gets no errors for the same exact uesry. The error is just thru the application.

    So the Table and the field format must be correct in order for Visdata.exe to accept the same exact quesry without any problems.

    What do you think?

  28. #28
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Can somebody PLEASE help

    if you dont have Access Installed the program can still work with the Database File .. no prob. ..

    Also, you have set field sizes on the Text Fields ...

    ill make some changes and send it back .. also in your Update make surte date fields only have # around it and no '

  29. #29

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Rory,

    Thanks, got the DB. It is coming up with the SAME EXACT error. No difference.

  30. #30

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    Do you think there is any RESERVED word may be as a field name?

  31. #31

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    476

    Re: Can somebody PLEASE help

    I found the problem THANK GOD.

    Field name Password. It is a reserved word.

  32. #32
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: [RESOLVED] Can somebody PLEASE help

    LOL .. you serious.. ? Where is the error ..?

    Anyway i always name my Databases like this ..

    If the table name is Website

    Website_ID
    Website_Name
    Website_Page

    etc ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width