Hi Guys, this one is bugging me as this should be so simple!
I am receiving datatype mismatch in criteria expression but i know the fields are set to number and my code is set to number, the left 6 digits will exist in the stock table but there may be text after it hence using the left,6 option!
Code:
Dim whQty As Long, avQty As Long, alQty As Long, mItemNo As Long
Dim wh As DAO.Recordset, al As DAO.Recordset, av As DAO.Recordset
If Left(Me.ItemType, 4) <> "Home" Then
DoCmd.CancelEvent
Else
mItemNo = Left(Me.ItemNo, 6)
Set wh = CurrentDb.OpenRecordset("Select tblStock.ItemNo, tblStock.StartQty From tblStock WHERE ItemNo = " & mItemNo)
Set av = CurrentDb.OpenRecordset("Select tblStock.ItemNo, tblStock.NewQty From tblStock WHERE ItemNo = " & mItemNo)
Set al = CurrentDb.OpenRecordset("Select tblStock.ItemNo, tblStock.AllocatedQty From tblStock WHERE ItemNo = " & mItemNo)
MsgBox ("Stock Details For Man No: " & mLiftNo & Chr(10) & Chr(10) & _
"Warehouse Qty: " & wh.Fields("StartQty") & Chr(10) & Chr(10) & _
"Allocated Qty: " & al.Fields("AllocatedQty") & Chr(10) & Chr(10) & _
"Available Qty: " & av.Fields("NewQty")), vbInformation + vbOKOnly, "RECORD DETAILS"
End If