Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Tomorrow, 04:18
- Joined
- Sep 6, 2004
- Messages
- 897
Hi again,
I tried to put my problem in my previous thread but it says 'Your massage can not be uploaded bcz you token has expired' Hence I am posting this.
I dont know what happened but suddenly produced above error at my second entry only and stuck up at Red highlted code line.
Run-time error '91'
Object varibale or With block variable not set
Private Sub Confirm_Click()
If Confirm.Value = -1 Then
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim TempCode
Dim TempQty, NEWPURQTY
Dim X: X = 0
TempCode = ProdCode
If Me.ProdCode = 1 Or Me.ProdCode = 500 Then
ElseIf Me.ProdCode = 1000 Or Me.ProdCode = 1500 Then
Set rst1 = CurrentDb.OpenRecordset("Select * from T_ComboProd Where ComboCode = " & TempCode)
rst1.MoveLast
rst1.MoveFirst
Do Until rst1.EOF
For X = 1 To rst1.RecordCount
Set rst2 = CurrentDb.OpenRecordset("Select * from T_ProductMaster where XCode = " & rst1!ComboCode & _
" And ProdCode = " & rst1!ProdCode & "")
NEWPURQTY = rst1!Qty
TempQty = rst2!Stock
rst2.Edit
rst2!Stock = TempQty + NEWPURQTY
rst2.Update
TempQty = 0
NEWPURQTY = 0
rst2.Close
rst1.MoveNext
'End If
Next X
Loop
End If
rst1.Close
Else
Other code here....
Regards,
Ashfaque
I tried to put my problem in my previous thread but it says 'Your massage can not be uploaded bcz you token has expired' Hence I am posting this.
I dont know what happened but suddenly produced above error at my second entry only and stuck up at Red highlted code line.
Run-time error '91'
Object varibale or With block variable not set
Private Sub Confirm_Click()
If Confirm.Value = -1 Then
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim TempCode
Dim TempQty, NEWPURQTY
Dim X: X = 0
TempCode = ProdCode
If Me.ProdCode = 1 Or Me.ProdCode = 500 Then
ElseIf Me.ProdCode = 1000 Or Me.ProdCode = 1500 Then
Set rst1 = CurrentDb.OpenRecordset("Select * from T_ComboProd Where ComboCode = " & TempCode)
rst1.MoveLast
rst1.MoveFirst
Do Until rst1.EOF
For X = 1 To rst1.RecordCount
Set rst2 = CurrentDb.OpenRecordset("Select * from T_ProductMaster where XCode = " & rst1!ComboCode & _
" And ProdCode = " & rst1!ProdCode & "")
NEWPURQTY = rst1!Qty
TempQty = rst2!Stock
rst2.Edit
rst2!Stock = TempQty + NEWPURQTY
rst2.Update
TempQty = 0
NEWPURQTY = 0
rst2.Close
rst1.MoveNext
'End If
Next X
Loop
End If
rst1.Close
Else
Other code here....
Regards,
Ashfaque