Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Access

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-15-2009, 11:45 AM
duckie10 duckie10 is offline Windows Vista Access 2007 (version 12.0)
Novice
 
Join Date: May 2009
Posts: 16
duckie10 is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 05-15-2009, 12:11 PM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,264
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

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.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
You do not have the necessary permissions to use the <name> object. Have your system alekbt Access 0 03-09-2009 01:09 PM
No value given for one or more required parameters 3dmgirl Queries 0 02-15-2007 12:07 PM
Set required user input ZeusOsiris Database Design 2 12-04-2006 04:13 PM
No object in this control mtrcar1 Access 0 10-12-2006 03:31 PM
Higlight an object on a map avgjoe Access 0 07-21-2006 04:52 AM


All times are GMT -8. The time now is 03:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.