Results 1 to 4 of 4

Thread: Please Help !!

  1. #1
    Join Date
    Jan 2003
    Location
    Jeddah
    Posts
    1

    Red face Unanswered: Please Help !!

    I moved from Access 97 to Xp ..
    when access makes the conversion, everything goes badly, take this as an example :

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim ThisOrd, OrdWas 'UPDATE Supplier ORDERS
    Dim DB As Database
    Dim Wrksp As Workspace
    Dim Branches As Recordset
    Dim Stocks As Recordset 'UPDATE QTY DEMAND IN STOCK MASTER

    If Me![QuantityOrd] * Me![UnitPrice] <= 0 Then
    Cancel = True
    MsgBox "The order line item must have a positive value", 16, "Re-check Quantity and Unit Price"
    Exit Sub
    End If
    If Me!ItemCode = "" And (IsNull(Me!ItemDescription) Or Me!ItemDescription = "") Then
    Cancel = True
    MsgBox "A descritpion of the goods is required where the item ordered is not a stock item.", 16, "Enter a Description Of the Ordered Goods"
    DoCmd.GoToControl "ItemDescription"
    Exit Sub
    End If

    Set Wrksp = DBEngine(0)
    Set DB = Wrksp.OpenDatabase(GetDBPath("StockMaster"))
    Set Stocks = DB.OpenRecordset("StockMaster", DB_OPEN_DYNASET)

    If Me!ItemCode.OldValue = Me!ItemCode Or IsNull(Me!ItemCode.OldValue) Then ' Only one stock item to update
    Stocks.FindFirst "StockID = '" & Me![ItemCode] & "'"
    Stocks.Edit
    If IsNull(Me!QuantityOrd.OldValue) Then OrdWas = 0 Else OrdWas = Me!QuantityOrd.OldValue
    If IsNull(Me!QuantityOrd) Then ThisOrd = 0 Else ThisOrd = Me!QuantityOrd

    ///// the problem arise here :
    ////method or data member not found on ..

    Stocks.QuantityOnOrder = (ThisOrd - OrdWas)
    Stocks.Update
    End If

  2. #2
    Join Date
    Nov 2002
    Posts
    150

    Re: Please Help !!

    Use Stocks!QuantityOnOrder = (ThisOrd - OrdWas)

  3. #3
    Join Date
    Nov 2002
    Posts
    150

    Re: Please Help !!

    Originally posted by FirstAndGoal4
    Use Stocks!QuantityOnOrder = (ThisOrd - OrdWas)
    or Stocks.Fields("QuantityOnOrder").Value = (ThisOrd - OrdWas)

    A "." typically is used to reference properties/methods native to access: RecordCount, FindFirst, etc..

    A "!" is used to reference user defined articles such as your QuantityOnOrder field.

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

    Re: Please Help !!

    yupperz. this should work..

    Stocks![QuantityOnOrder] = (ThisOrd - OrdWas)
    Stocks!Update

Posting Permissions

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