![]() |
|
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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" |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |