I swear I hate Access sometimes!
OK, so here is my VBA code attached to a command button. The point of the button is obviously to toggle the source of a specific field:
If Me.txtNum.ControlSource = "=[TemplateSequence] & ""."" & [LineItemNumber]" Then
Me.txtNum.ControlSource = "LineItemNumber"
Me.cmdRenumber.Caption = "Auto Renumber"
Me.txtNum.ControlSource = "=[TemplateSequence] & ""."" & [LineItemNumber]"
Me.cmdRenumber.Caption = "Manual Renumber"
This works just fine unless a user presses the command button repeatedly. After a few times, Access throws this error message on the command "Me.txtNum.ControlSource = ...". Does not matter which IF condition is being processed -- sometimes happens on the true condition and sometimes on the ELSE condition.
Here is the error -- it makes no sense to me:
error number 3125, "'select * from....(this appears to be the recordsource of the form)' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long."
I can't make rhyme or reason here. Works just fine, then suddenly pops up what seems to be a bogus error.
Anybody have ideas here?
P.S. I know somebody is going to say rebuild the form. That would take hours and hours because this is a *very* complex form with lots of tabs, subforms, and form automation.