Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Tomorrow, 04:09
- Joined
- Sep 6, 2004
- Messages
- 897
Hi Gents,
I have below code thru which I am transfering records to Excel sheet from T_SOHeader table and T_SOFooter1 table which are based on One-To-Many relationship. I have many records existing in said header and footer table. I need to pick them up with date criteria for a particular period.
My code to open Excel application etc are fine.
Here is the vba code that says No Records
----codes to open Excel...
----
-----
Set rst = CurrentDb.OpenRecordset("SELECT T_SOHeader.InvNum, T_SOHeader.SODate, T_SOHeader.CustomerName, " & _
"T_SOFooter1.ProductName, T_SOFooter1.ProductClass, T_SOFooter1.NoOfBags, T_SOFooter1.FreeQty as PromoQty, " & _
"WeightInKgPerBag, (NoOfBags + FreeQty) As TotQty, ((NoOfBags + FreeQty) * WeightInKgPerBag /1000) As " & _
"MT, T_SOFooter1.RecordId " & _
"FROM T_SOHeader LEFT JOIN T_SOFooter1 ON T_SOHeader.InvNum=T_SOFooter1.InvNum " & _
"WHERE (T_SOHeader.SODate) >= " & #1/12/2009# & " And " & _
"(T_SOHeader.SODate) <= " & #12/25/2009# & " " & _
"Group By T_SOHeader.InvNum, T_SOHeader.SODate, T_SOHeader.CustomerName,T_SOFooter1.ProductName, " & _
"T_SOFooter1.ProductClass,T_SOFooter1.NoOfBags, T_SOFooter1.FreeQty, T_SOFooter1.WeightInKgPerBag, " & _
"T_SOFooter1.RecordId;")
If rst.EOF And rst.BOF Then
MsgBox ("No Records In This Month"), vbInformation, "Null Records Inf."
Exit Sub
Else
----other code lines...
I am entering dates thru 2 text boxes palced on a form called F_ReportMaster. So tried even to change the criteria below way BUT IT DESPLAYS my given msg "No Records In This Month"...
'"WHERE (T_SOHeader.SODate) >= " & [Forms]![F_ReportMaster]![TxtFrom] & " And " & _
'"(T_SOHeader.SODate) <= " & [Forms]![F_ReportMaster]![TxtTo] & " " & _
Can you please extend your help.....
With kind regards,
I have below code thru which I am transfering records to Excel sheet from T_SOHeader table and T_SOFooter1 table which are based on One-To-Many relationship. I have many records existing in said header and footer table. I need to pick them up with date criteria for a particular period.
My code to open Excel application etc are fine.
Here is the vba code that says No Records
----codes to open Excel...
----
-----
Set rst = CurrentDb.OpenRecordset("SELECT T_SOHeader.InvNum, T_SOHeader.SODate, T_SOHeader.CustomerName, " & _
"T_SOFooter1.ProductName, T_SOFooter1.ProductClass, T_SOFooter1.NoOfBags, T_SOFooter1.FreeQty as PromoQty, " & _
"WeightInKgPerBag, (NoOfBags + FreeQty) As TotQty, ((NoOfBags + FreeQty) * WeightInKgPerBag /1000) As " & _
"MT, T_SOFooter1.RecordId " & _
"FROM T_SOHeader LEFT JOIN T_SOFooter1 ON T_SOHeader.InvNum=T_SOFooter1.InvNum " & _
"WHERE (T_SOHeader.SODate) >= " & #1/12/2009# & " And " & _
"(T_SOHeader.SODate) <= " & #12/25/2009# & " " & _
"Group By T_SOHeader.InvNum, T_SOHeader.SODate, T_SOHeader.CustomerName,T_SOFooter1.ProductName, " & _
"T_SOFooter1.ProductClass,T_SOFooter1.NoOfBags, T_SOFooter1.FreeQty, T_SOFooter1.WeightInKgPerBag, " & _
"T_SOFooter1.RecordId;")
If rst.EOF And rst.BOF Then
MsgBox ("No Records In This Month"), vbInformation, "Null Records Inf."
Exit Sub
Else
----other code lines...
I am entering dates thru 2 text boxes palced on a form called F_ReportMaster. So tried even to change the criteria below way BUT IT DESPLAYS my given msg "No Records In This Month"...
'"WHERE (T_SOHeader.SODate) >= " & [Forms]![F_ReportMaster]![TxtFrom] & " And " & _
'"(T_SOHeader.SODate) <= " & [Forms]![F_ReportMaster]![TxtTo] & " " & _
Can you please extend your help.....
With kind regards,