Forum Discussion
Storming
Apr 14, 2020Brass Contributor
VAT calculation
Hi, I want to calculate VAT (generally 20%) from a gross amount. I want to be able to format it to 2 dec places so that if the pence is .100 to .104 the pence stays as .10 but if the pence is .105 t...
- Jul 19, 2024
Your method works, but you can simplify it by using:
```sql
CCur(Round([Gross Amount] * [VAT Percentage] / (100 + [VAT Percentage]), 2))
```
This VAT Calculator method keeps it as currency and exports correctly to Excel.
George Hepworth
Apr 14, 2020Steel Contributor
Storming I read the calculation and can think of no BETTER way to do it. There are, no doubt, other ways. At this point in my career, I give precedence to methods that WORK over methods that involve lots of elegant, complicated code. If that gives you the result you need, it's good. Otherwise, you could invest additional hours in a solution that may or may not be better.
Access does do rounding in a way that doesn't always work for every circumstance.
I once had to work on a similar problem for a client who was doing sophisticated performance testing for sports equipment. They needed rounding as you do. I came up with an approach similar to yours to calculate it as they wanted/needed it for their reports because one test out of many dozens would be off as far as they were concerned due to Access default rounding. As I recall it was a bit more involved than your (relatively) simple solution. Whatever works.
If trial and error tells you this method works as required, and does so reliably, why invest additional time looking for something else.
I
Storming
Apr 15, 2020Brass Contributor
Hi George, thanks for your help again, it is certainly appreciated.
I could just not believe that someone had not posted a solution before to this problem as surely a lot of businesses would be required to use the same calculation.
- George HepworthApr 15, 2020Steel Contributor
Storming I strongly suspect that most of the time, people who have confronted this problem have just worked out a solution as you were able to do.
- StormingMay 05, 2020Brass Contributor
Hi George, just wondering if you could help me with another problem.
I am trying to open a Word document containing the user manual at different bookmarks depending on which form the user is on.
I have the following code:-
Private Sub Command35_Click()
Dim strPath As String
strPath = "C:\Users\norma\Desktop\Phili CCC business management system user manual.docx"
Dim objWord As Object
Dim docWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set docWord = objWord.Documents.Open(FileName:=strPath, ReadOnly:=True)
docWord.Bookmarks("MainMenu").Select
objWord.Activate
WindowState = wdWindowStateMaximised
End SubThe Word document opens fine but I can not get it to be maximised.
The other problem is that the Word document opens at the bookmark but the bookmark is at the bottom of the maximised screen showing half of the previous page above it. See attachment.
Any idea how to resolve that please so that the bookmark starts at the top of the page?
- George HepworthMay 05, 2020Steel Contributor
Storming Unfortunately, automating Word is not in my skill set. I suggest you re-post this question in the Word forum where Word experts can see it. Sorry.