M
Mary
Hi All,
I am usng ASP and Access 2003 to write the inventory, I need to generate a
report based on an inventory datebase, please focus on GNO = G11.....
ExDate = 2010/3/31
GDate InvNo GNo Qty Price
2010/3/28 1001 G11 10 30 ---------->Line No1
2010/3/28 1001 G12 40 40
2010/3/29 1002 G11 10 50
2010/3/29 1002 G12 40 60
2010/3/30 1003 G11 10 70
2010/3/30 1003 G12 40 80
SQL = "Select GNo, Last(Price) As LastPrice, Sum(Qty) As AAA From Inventory
Where GDate <= #" & ExDate & "# And GNo = '" & GNo & "' Group By GNo"
The result is below.....
GNo rs("AAA") rs("LastPrice")
G11 30 70
G12 120 80
But, after I delete Line 1 and post a new entry from a form, Access put it
to the bottom, it become...
GDate InvNo GNo Qty Price
2010/3/28 1001 G12 40 40
2010/3/29 1002 G11 10 50
2010/3/29 1002 G12 40 60
2010/3/30 1003 G11 10 70
2010/3/30 1003 G12 40 80
2010/3/28 1001 G11 10 30
Then I run SQL, it give me a wrong result as below, I hope it can still show
the latest price, the correct latest price of G11 is 70.....
GNo rs("AAA") rs("LastPrice")
G11 30 30
G12 120 80
Then I add " Order By InvNo" following the SQL syntax, it show error. How to
solve this problem. Please help, thanks a lot !
I am usng ASP and Access 2003 to write the inventory, I need to generate a
report based on an inventory datebase, please focus on GNO = G11.....
ExDate = 2010/3/31
GDate InvNo GNo Qty Price
2010/3/28 1001 G11 10 30 ---------->Line No1
2010/3/28 1001 G12 40 40
2010/3/29 1002 G11 10 50
2010/3/29 1002 G12 40 60
2010/3/30 1003 G11 10 70
2010/3/30 1003 G12 40 80
SQL = "Select GNo, Last(Price) As LastPrice, Sum(Qty) As AAA From Inventory
Where GDate <= #" & ExDate & "# And GNo = '" & GNo & "' Group By GNo"
The result is below.....
GNo rs("AAA") rs("LastPrice")
G11 30 70
G12 120 80
But, after I delete Line 1 and post a new entry from a form, Access put it
to the bottom, it become...
GDate InvNo GNo Qty Price
2010/3/28 1001 G12 40 40
2010/3/29 1002 G11 10 50
2010/3/29 1002 G12 40 60
2010/3/30 1003 G11 10 70
2010/3/30 1003 G12 40 80
2010/3/28 1001 G11 10 30
Then I run SQL, it give me a wrong result as below, I hope it can still show
the latest price, the correct latest price of G11 is 70.....
GNo rs("AAA") rs("LastPrice")
G11 30 30
G12 120 80
Then I add " Order By InvNo" following the SQL syntax, it show error. How to
solve this problem. Please help, thanks a lot !