Tip To all those who have a problem... (1 Viewer)

Chrisopia

Registered User.
Local time
Today, 14:38
Joined
Jul 18, 2008
Messages
279
I have noticed my stress free evenings are more frequent after being able to do the most simple tasks now, and make them work... even with microsoft being a pain in the backside...

the reason...

I learned VB!

Mainly taking tips from posts on this site, but I found doing things VB instead of following wizards and macro make things work!

They work so well infact, I'm going back trhough my entire system and translating everything into VB...

for example I had a problem with a control what read "Invoice" or "quote" depending on a field, trouble is, whenever I tried to include another table it would only read "error"... later I went back and instead of putting the code in the control itself,

Code:
IIF([Ordertype]=1,"Invoice","Quote")

I created it in VB

Code:
Dim Typ As String
Typ = [Reports]![White]![OrderType]
If Typ = 1 Then
[Reports]![White]![TypeIQ] = "Invoice"
Else: [Reports]![White]![TypeIQ] = "Quote"

End If
Code:
Reads the ordertype information and stores it in a variable 'Typ'
If 'Typ' = 1 continue (Stamp TypeIQ as Invoice), or else stamp TypeIQ as Quote
Where TypeIQ is the box to display this.
Now I don't have a single problem with coding and things work so much more smoother.

Another VERY useful tip is the msgBox tool... it tells you if the code doesnt work, where it's going wrong for example
Code:
Dim Loc As String
Loc = Me![frmWizz 002a Add Order].Form![OrderID]
[COLOR=Blue]MsgBox Loc[/COLOR]
DoCmd.OpenForm "frmWizz 003 Add Order Details", acNormal, , "[OrderID]=" & Loc
End Sub

This msgBox should return a number - OrderID. If it doesn't I will know I haven't referenced 'Loc' properly.
Also using Loc saves time and memory... (Loc is a var i invented, short for Location)
Next it opens a form where the OrderID of that form is the same as Loc.

It is a sense of achievment when things work.

Hope this helps :)

Chris.
 

Users who are viewing this thread

Top Bottom