Sep 11 2007, 09:54 AM
I have this subform that is a continuous form which contains a combobox. Im trying to create a field validation for that combobox so that if its null, a warning box pops up and does not allow the user to close the main form unless a value is selected. The code I have below doesn't seem to work. I can still close the form when the combobox is null. Can someone please tell me what im doing wrong. Thanks
If IsNull(Me.JobTraderSubform_sfrm.Form.JobTraTraderNumber) Or _ Me.JobTraderSubform_sfrm.Form.JobTraTraderNumber = "" Then
MsgBox "Warning: You need to select a Trader.", vbOKOnly, "Warning"
Sep 11 2007, 10:06 AM
Where do you have this code? You might have to put it in both the AfterUpdate event of the control and the BeforeUpdate event of the form. HTH.
Sep 11 2007, 10:08 AM
I have it on the before update event on the subform. I'll try it on the both afterupdate and beforeupdate on the main form. thanks!
Sep 11 2007, 10:18 AM
I'm not sure if I'm doing this correctly. I added the code to the AfterUpdate event on the combobox and to the BeforeUpdate on main form, but I get an Compile Error: Method or data member not found. for the BeforeUpdate event and highlighted the JobTraderSubform_sfrm.
Sep 11 2007, 10:31 AM
Sorry, didn't know that you had a subform. The error is caused by improper reference to the control in the subform from the main form. See this article
for more information. HTH.
Sep 11 2007, 10:48 AM
Nevermind.....I got it to work.
Sep 11 2007, 11:49 AM
Glad to hear that. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here