How to Calculate SGST, CGST, and IGST in an Access Subform
Question details
The user needs a method to dynamically calculate SGST, CGST, and IGST within an Access subform based on the customer's state and individual product GST rates.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Building an order and billing database where tax must be accurately computed on a per-product line item basis rather than on the total sale.
- Observed behavior
- The database needs to split the tax into SGST and CGST for local sales, or combine it into IGST for interstate sales, applying these rules dynamically at the subform level.
Ensure your Customer table includes a State or Region field to accurately determine the sale type, and your Product table includes a specific GST percentage field for each individual item.
Configure Dynamic Calculations in the Bill Details Subform
Use conditional expressions in your subform query to evaluate the sale type per transaction and calculate the correct tax values based on the product's assigned tax rate.
To handle dynamic GST calculations correctly, you must evaluate the sale type for each specific transaction line. Because GST rates vary across different products (e.g., 5%, 12%, 18%), calculating it strictly at the total bill level is often inaccurate.
Local sales require the product's GST rate to be divided equally into SGST and CGST. Interstate sales require the full GST rate to be applied entirely to IGST.
Set up the Record Source query for your subform. Ensure it joins the Products table (to fetch the [GSTRate]) and references the Customers table or main form (to determine [CustomerState]).
In the query design grid or a calculated text box on the subform, use an IIF statement to assign half the tax to SGST for local sales: IIf([CustomerState]=[LocalState], ([Amount]*[GSTRate])/2, 0).
Similarly, configure the CGST field using the exact same logic for the remaining half of the tax: IIf([CustomerState]=[LocalState], ([Amount]*[GSTRate])/2, 0).
For interstate sales, apply the full tax rate to IGST by returning zero if it is a local sale, and the full rate if it is not: IIf([CustomerState]<>[LocalState], [Amount]*[GSTRate], 0).

Simplify Your Billing and Tax Calculations with WPS Spreadsheet
Microsoft Access can be overly complex and difficult to maintain for simple billing and invoicing solutions. WPS Spreadsheet offers a highly compatible, free, and lightweight alternative. You can easily create automated GST invoice templates using familiar formulas like IF and VLOOKUP, ensuring seamless calculation of SGST, CGST, and IGST without the overhead of maintaining a relational database.

Frequently Asked Questions
Why should tax be calculated on the subform per product line instead of the total bill?
Because different products often have varying GST rates (e.g., 5%, 12%, 18%). Calculating the tax at the subform line level ensures the correct specific rate is applied to each item before summarizing the total bill.
How do I handle historical invoice data if GST rates change in the future?
Instead of directly calculating the tax in the subform by continually referencing the Product table's current rate, use an Update Query or VBA to copy the product's GST rate into a static 'AppliedTaxRate' field in your BillDetails table at the exact time of purchase.
Can I use VBA instead of calculated query fields for GST in Access?
Yes. You can use the AfterUpdate event of the Product selection combo box on your subform to retrieve the GST rate, check the customer's state, and populate the SGST, CGST, and IGST bound text boxes programmatically.




