Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

What is wrong with this form?

Earlier this week an expert helped me with a checkbox issue.  But I have turned the Main Form into a form with 7 sub-forms.  I cannot figure out why when I enter, for example, a Start Time and End Time in the Sunday subform, I get "Invalid use of null" and the times go blank.  And yet if I close and re-open the form it seems to look ok.  Can someone tell me what is wrong?

Sample file attached.Test.accdb
Avatar of ste5an
ste5an
Flag of Germany image

Well, I only get that error, when I tab out of the end time field. Which does a move to the next row of the data source, which is the new, empty row. Thus your error.

While having error handling in place for the final product, I cannot recommend this style of error handlers during development. It clutters the code and makes it hard to read. And it hides the error and disables the debug feature of the VBA IDE.

Refactor your application. There is no need for separate forms. You only need one single sub form and reuse it for each day.

Always use Dim As Long, never Dim As Integer as long as you don't have explicit reqreuiments. Integer (-32k to +32k) can and will overflow in the one or other use-case.
Avatar of SteveL13

ASKER

I changed all of the sub-forms to Cycle = Current Record and the issue went away.  Also, I need to be able to see the entire week, hence 7 sub-forms.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial