T
Tony L.
My invoicing Forms run well in Access 2003 in Windows XP. On the operator's
input of the item code (one by one), DLookup gets the item name and price;
the total for that item is displayed after multiplying the price and quantity
and discount; finally the Grand Total is displayed. The same steps are
repeated as the operator inputs the other items.
But on switching to Windows Vista, the Grand Total does not add up.
Obviously the 'Sendkeys' function is not working properly. Extracted below
are my codings. Grateful for help please.
---------------------------------------------------------------
Private Sub MCode_AfterUpdate()
Dim mydb As Database, myrs As Recordset
Set mydb = CurrentDb()
Set myrs = mydb.OpenRecordset("Select [Inventory].* From [Inventory]
Order by [Inventory].
input of the item code (one by one), DLookup gets the item name and price;
the total for that item is displayed after multiplying the price and quantity
and discount; finally the Grand Total is displayed. The same steps are
repeated as the operator inputs the other items.
But on switching to Windows Vista, the Grand Total does not add up.
Obviously the 'Sendkeys' function is not working properly. Extracted below
are my codings. Grateful for help please.
---------------------------------------------------------------
Private Sub MCode_AfterUpdate()
Dim mydb As Database, myrs As Recordset
Set mydb = CurrentDb()
Set myrs = mydb.OpenRecordset("Select [Inventory].* From [Inventory]
Order by [Inventory].
Code:
", dbOpenDynaset)
myrs.FindFirst "[Code] = '" & Me.mCode & "'"
If Not myrs.NoMatch Then
mDescription = myrs("[Name1]")
mUnitPrice = myrs("[Selling Price]")
DisplayPrice
Else
MsgBox " Code Not Registered ... Re-enter Code Please "
End If
myrs.Close
End Sub
Private Function DisplayPrice()
mTotalUnitPrice = mUnitPrice * mUnitDiscount * mQuantity
SendKeys "+{ENTER}", True
DisplayTotal
End Function
Private Function DisplayTotal()
Dim myset As Recordset, mtot As Double
Set myset = Me.RecordsetClone
If myset.RecordCount <= 1 Then
Me.Parent.mTotal = Me.mTotalUnitPrice
Else
myset.MoveFirst
mtot = 0
Do While Not myset.EOF
mtot = myset("[Total Unit Price]") + mtot
myset.MoveNext
Loop
Me.Parent.mTotal = mtot
End If
End Function
---------------------------------------------------------------