Results 1 to 3 of 3

Thread: Sql Help

  1. #1
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132

    Unanswered: Sql Help

    Hi everyone can some one tell me whats wrong with this sql statment , im sure that its not handling the DESC right cuz of quotes

    but donno how to fix it. i would appreciate your help.
    bye
    Private Sub cmdWorkOrder_Click()
    If ErrorTrapping = True Then
    On Error GoTo Err_cmdWorkOrder_Click
    End If
    Dim curdb As Database
    Dim adrs As Recordset
    Dim SQLStmt, response, stLinkCriteria, stDocName, ItemNo,Desc As String
    Set curdb = CurrentDb()
    ItemNo = Me![Item Number]
    Desc = Me![Description]
    'Desc is FJP COL SQUARE PLAIN 8"X 8' C/W MDF CAP & BASE
    'I konw its not handling all these quotes right.
    SQLStmt = "Insert into [Inventory WorkOrder] ([Item Number],[Work Order Date],[Sales Order

    Number],[Description],[Quantity In Stock],[Quantity Ordered],[Quantity On Back Order]) Values ('" & ItemNo & "','" & Date

    & "',' & Forms![Sales Order]![Sales Order Number] & ','" & Desc & "','" & Me![Quantity in Stock] & "','" & Me![Qty

    Ordered] & "','" & Me![BO Qty] & "')"
    curdb.Execute (SQLStmt)
    stDocName = "yWorkOrder2"
    DoCmd.OpenForm stDocName, , , Forms![Sales Order]![Sales Order Number] = Forms![Sales Order]![Sales Order

    Number]
    DoCmd.Close A_FORM, "ySales Order Item Out of Stock"

    Exit_cmdWorkOrder_Click:
    Exit Sub
    Err_cmdWorkOrder_Click:
    MsgBox Err.Description & Err.Source & Err.Number
    Resume Exit_cmdWorkOrder_Click
    End Sub

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    i think your problems here:

    Date & "',' & Forms![Sales Order]![Sales Order Number] & ','"

    i see 2 missing "
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Just another thing to think about, SQL server also takes # infrount and inback of dates....This may also be your problem.
    Jim

Posting Permissions

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