Results 1 to 2 of 2
  1. #1
    duckie10 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2009
    Posts
    16

    Object required

    Private Sub QTY_ORDERED_LostFocus()
    Dim strSQL As String
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

    Set cn = CurrentProject.Connection

    Set rs = New ADODB.Recordset

    Dim Qty_Ordered_int As Integer


    Set Qty_Ordered_int = CInt(Me.[Qty Ordered].Value)




    strSQL = "SELECT ONHAND " & _
    "FROM Inventory " & _
    "WHERE [INVENTORY ID] = '" & [INVENTORY ID].Value & "'"

    rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText

    Do While Not rs.EOF



    If rs.Fields("ONHAND").Value >= Qty_Orderd_int Then
    Me.[Qty Shipped] = Me.[Qty Ordered]
    Me.[Qty Back Ordered] = 0

    Else
    If rs.Fields("ONHAND").Value < Qty_Ordered_int Then
    If rs.Fields("ONHAND") > 0 Then
    Me.[Qty Shipped] = rs.Fields("ONHAND").Value
    Me.[Qty Back Ordered] = Me.[Qty Ordered] - rs.Fields("ONHAND").Value

    End If
    End If
    End If




    rs.MoveNext
    Loop

    rs.Close
    Set rs = Nothing

    cn.Close
    Set cn = Nothing

    End Sub




    Set Qty_Ordered_int = CInt(Me.[Qty Ordered].Value)


    I am receiving error on this line--Object required. How do I fix it?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do not Set an integer.
    Set Qty_Ordered_int = CInt(Me.[Qty Ordered].Value)
    ...s/b...
    Qty_Ordered_int = CInt(Me.[Qty Ordered].Value)
    ...or...
    Let Qty_Ordered_int = CInt(Me.[Qty Ordered].Value)
    ...if you like.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 03-09-2009, 03:09 PM
  2. Replies: 0
    Last Post: 02-15-2007, 03:07 PM
  3. Set required user input
    By ZeusOsiris in forum Database Design
    Replies: 2
    Last Post: 12-04-2006, 07:13 PM
  4. No object in this control
    By mtrcar1 in forum Access
    Replies: 0
    Last Post: 10-12-2006, 05:31 PM
  5. Higlight an object on a map
    By avgjoe in forum Access
    Replies: 0
    Last Post: 07-21-2006, 06:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums