Whats wrong in this code (1 Viewer)

Ashfaque

Student
Local time
Today, 07:48
Joined
Sep 6, 2004
Messages
894
It is simply great. It make easier to write the vba code this way.

Thanks for the help.

Have you seen my post # 19 in the same thread ?

With kind regards,
Ashfaque
 

Poppa Smurf

Registered User.
Local time
Today, 12:18
Joined
Mar 21, 2008
Messages
448
Re Post #19

The attached uses similar code to my last post, when you open your form and click on Monthly Sales a module test_grouping is called.

This module deletes a table then cycles through the records and adds the records to the table as per your requirement. You maybe able to use this tables to populate your worksheet or modify the code for your excel code.
 

Attachments

  • MonthlySales_grouping_test_002.zip
    176.6 KB · Views: 113

Ashfaque

Student
Local time
Today, 07:48
Joined
Sep 6, 2004
Messages
894
Another excellent trick.

Thanks a lot

I can further add my fields to temp table and transfer data to excel sheet in desired format.

Regards,
Ashfaque
 

Ashfaque

Student
Local time
Today, 07:48
Joined
Sep 6, 2004
Messages
894
I need call recordset where there is 0 or null value in one of its field. Because most ot the time FreeQty field might be with 0 value. I tried this way into your code but doesn't work. (I already increased fields in tbl_grouping)

If Not IsNull(!FreeQty) Or !FreeQty> 0 Then
rst_output("FreeQty") = ![FreeQty]
Else
rst_output("FreeQty") = "0"
End If

Please advise

Thanks for your efforts...

Regards,
Ashfaque
 

Poppa Smurf

Registered User.
Local time
Today, 12:18
Joined
Mar 21, 2008
Messages
448
In your Sql you are using T_SOFooter1.FreeQty AS PromoQty where PromoQty is the ALIAS for FreeQty. This Alias must replace FreeQty in the code below, also in the ELSE the "0" should be 0 as it is a number not a string
If Not IsNull(!FreeQty) Or !FreeQty> 0 Then
rst_output("FreeQty") = ![FreeQty]
Else
rst_output("FreeQty") = "0"
End If

Correct Code
If Not IsNull(!PromoQty) Or !PromoQty> 0 Then
rst_output("FreeQty") = ![PromoQty]
Else
rst_output("FreeQty") = 0
End If
 

Ashfaque

Student
Local time
Today, 07:48
Joined
Sep 6, 2004
Messages
894
Bravo...

Thanks for the help.....it works now

Regards,
Ashfaque
 

Users who are viewing this thread

Top Bottom