Good morning
I am fairly newbie in Access VBA, and I cannot figure out the best way to validate a form. Let me explain: I got the following piece of code with an input form named as “frmEnterData” containing a list box named as “ListMketer,” a text box named as “HEC” and finally other list box named as “MonthBR”. These are input from my program.
When I call in debug mode the form, I can enter the values one by one; however in run mode the error:94 “invalid use of null” happened as the code does not wait until I enter the data. I tried to use the beforeUpdate event and the enter event in the form but it does not work. So I try to use a do while statement and error handler but fails as the program stays forever in the loop without leave the user post the options.
I need a way that the code stops, accept & validate the inputs and then continue into the program.
--------------------portion of my code
Sub Enterdata()
Dim Mketer As String, MonthBR As String
Dim HECAmount As Currency,
'Enter the HEC $ amoun billed , Marketer Group and month
DoCmd.OpenForm "frmEnterdata"
'Pass variables from the entryForm
Mketer = Forms("frmEnterdata")!ListMketer
HECAmount = Forms("frmEnterdata")!HEC
MonthBR = Forms("frmEnterdata")!MonthBR
MonthNum = Month(CDate(MonthBR & " 1," & Year(Date)))
'…
'…(MORE CODE)
End Sub