Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Today, 06:34
- Joined
- Sep 6, 2004
- Messages
- 894
Hi,
One of my sub form named F_SalesInvFoot based on table T_SalesInvFoot. This footer table having below fields.
AccNewCode (Text)
InvDate(Date)
SalesQty(Number)
The sub form has been placed in main form called F_SalesInvHead with one to many relationship.
These all works well.
The other form called F_Gift_C have few fields on it where I am displaying
AccNewCode (Text)
InvDate(Date)
etc....
I m using this form to issue gift to customer depend on thier purchase of cartons.
This main form (F_Gift_C) have another subform called SF_GiveAways which has some bound fields along with a combo box. This combo is used select
What I am trying to do is like this....I want to have sum of SalesQty from table called T_SalesInvFoot.
I am displaying From - To date and AccNewCode on header from (F_Gift_C) based on which my above record set code should generate sum of SalesQty (carton qty) for the selected period and specific customer (AccNewCode) . Off course this will be triggered once the combo box is updated in footer form.
The below code I wrote behind after update of combo.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim TotCarton: TotCarton = 0
Set rst = CurrentDb.OpenRecordset("Select AccNewCode, InvDate, Sum(SalesQty) As TotCarton " & _
"FROM T_SalesInvFoot Where Invdate>= #" & Forms!F_Gift_C!TxtFrom & "# And InvDate <= #" & Forms!F_Gift_C!TxtTo & "# And AccNewCode = '" & Forms!F_Gift_C!AccNewCode & "'" & _
"GROUP BY AccNewCode;")
TotCarton = rst!TotCarton
But rst!TotCarton generates nothing while there is data in footer table and I dont find error in the code.
Any help will be appreciated....
One of my sub form named F_SalesInvFoot based on table T_SalesInvFoot. This footer table having below fields.
AccNewCode (Text)
InvDate(Date)
SalesQty(Number)
The sub form has been placed in main form called F_SalesInvHead with one to many relationship.
These all works well.
The other form called F_Gift_C have few fields on it where I am displaying
AccNewCode (Text)
InvDate(Date)
etc....
I m using this form to issue gift to customer depend on thier purchase of cartons.
This main form (F_Gift_C) have another subform called SF_GiveAways which has some bound fields along with a combo box. This combo is used select
What I am trying to do is like this....I want to have sum of SalesQty from table called T_SalesInvFoot.
I am displaying From - To date and AccNewCode on header from (F_Gift_C) based on which my above record set code should generate sum of SalesQty (carton qty) for the selected period and specific customer (AccNewCode) . Off course this will be triggered once the combo box is updated in footer form.
The below code I wrote behind after update of combo.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim TotCarton: TotCarton = 0
Set rst = CurrentDb.OpenRecordset("Select AccNewCode, InvDate, Sum(SalesQty) As TotCarton " & _
"FROM T_SalesInvFoot Where Invdate>= #" & Forms!F_Gift_C!TxtFrom & "# And InvDate <= #" & Forms!F_Gift_C!TxtTo & "# And AccNewCode = '" & Forms!F_Gift_C!AccNewCode & "'" & _
"GROUP BY AccNewCode;")
TotCarton = rst!TotCarton
But rst!TotCarton generates nothing while there is data in footer table and I dont find error in the code.
Any help will be appreciated....