[RESOLVED] Required field entry datat if combobox value is select?
Hello all
I`m new in this forum, and I have start learning VB for about 1month.
I need help regarding one code.
I have create a few text and combobox fields in form, and I want to IF I SELECT SPECIFIC VALUE IN COMBO BOX, THEN xxxx field must not be empty.
I have try with this code, but I don`t know what is wrong, because the information message does not turn off when I press OK button???!!!
Please help, and thanks in advance to helpers!!!
if me.cboName = "john" then
msgbox ("You have to fill ADDRESS field!", vbinformation + vbOkOnly)
cancel = true
me.address.setfocus
end if
Re: Required field entry datat if combobox value is select?
Welcome to the Forums.
First suggestion, if you are just learning, consider switching to VB.Net (Visual Studio 2008/2010) because VB6 is becoming very old at this point and it may even not be supported at all by the next version of Windows.
Regarding your problem, can you explain in more detail what you are making and what it does, I have a feeling it can be done simpler than that. Maybe send us a screenshot of your Form.
Re: Required field entry datat if combobox value is select?
Visual Basic.NET is a replacement of VB6. I know that VB6 is the latest one version of language, but I didnt know anything about that.
What is the different between this .NET and VB6? At the moment I`m learning VB with MSAccess tool.
I have add print screen. So, if you will looked at pictures. If I select ThirdParty value from combobox, then all ThirdParty field must entry data!
Re: Required field entry datat if combobox value is select?
I think this will help you...
Code:
if cboName.Text = "john" then
msgbox ("You have to fill ADDRESS field!", vbinformation + vbOkOnly)
address.setfocus
Exit Sub '~~~> Prevents the rest of the code from executing
end if
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
Re: Required field entry datat if combobox value is select?
Originally Posted by dejanc
At the moment I`m learning VB with MSAccess tool.
Thread moved to 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt
Re: Required field entry datat if combobox value is select?
Originally Posted by dejanc
It is working!!!!
THANKS akhileshbc
Welcome...
If that solved your problem, don't forget to mark the thread as RESOLVED (from Thread Tools found at the top of this page)
Good luck....
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India