How do I make row source appear in my checkbox?
Default and mandatory field functions
Collapse
X
-
My guess is you will just need to code that yourself. Probably something like...Originally posted by CyberdyneOk I got it now
How can I make field 2 Mandatory? In other words I want it to have a value that a person will choose from the list, but if you don't choose you can't proceed.
let me know thanks
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) ' If your Field1 checkbox is ticked Then ' If you don't like the contents of field2 Then Cancel = True MsgBox "Get it right, dopey!" ' End If ' end If End SubComment
-
Originally posted by Killer42My guess is you will just need to code that yourself. Probably something like...
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) ' If your Field1 checkbox is ticked Then ' If you don't like the contents of field2 Then Cancel = True MsgBox "Get it right, dopey!" ' End If ' end If End Sub
Where would I insert this code? In Field1 or Field2 and where in those fields?
So I will right click on the field go to properties go to Event and then in Before Update I will go in to the code and copy and paste that code?Comment
-
No, this is the BeforeUpdate event for the form. If this is the correct place for it (it was just a suggestion, after all) you would need to set the Before Update event on the form to [Event Procedure]. Then click the ... to go to the code editor, and insert this code. Note that the procedure declaration (the Private Sub and End Sub lines) will already be filled in, so skip those.Originally posted by CyberdyneWhere would I insert this code? In Field1 or Field2 and where in those fields?
So I will right click on the field go to properties go to Event and then in Before Update I will go in to the code and copy and paste that code?
Also, I hope you realise that this code won't run as-is. A lot of it is made up of comments simply showing where to put your code. For example, where it says ' If your Field1 checkbox is ticked Then you need to put the code to test the checkbox.Comment
-
I got it, its working fine, I am able to make it appear once I check field one. For some reason its still not mandatory though, I can still continue onto the next entry without the "Please Enter the name of the User for Field 2"
Any suggestions?Comment
-
Can you post the code, so we can see exactly how you implemented it? It usually turns out to be some teeny little detail that's slightly different, so you need to see the actual code to find it.Originally posted by CyberdyneI got it, its working fine, I am able to make it appear once I check field one. For some reason its still not mandatory though, I can still continue onto the next entry without the "Please Enter the name of the User for Field 2"Comment
-
Hope I understand you correctly: Lets add Field3, Field4 and Field5
Set Field2-5 to
Enabled=False
Locked=True
'and
Me.Field1="No"
then on AfterUpdate event of Field1 put this:
then put this on AfterUpdate event of Field2:Code:If me.Field1.value="Yes" then me.Field2.Enabled=True me.Field2.Locked=False else me.Field2.Enabled=false me.Field2.Locked=true end if
The above will really force the user user to enter value in Field2 before going to other fields but if the user select "No" then no data entry will happen or just the Field1 will be filled-in.Code:If not isnull(me.field2) then ' enable and unlock the rest of the fields end if
HTH,
George
Originally posted by CyberdyneI have two fields
Field1 - has options Yes or No
Field2 - has three options to chose from
First: What do I need to do to make Field1 be No and Field2 not selectable by default?
Second: If Field1 is selected as Yes I want Field2 to become selectable and mandatory.
Let me know, Cyberdyne.Comment
Comment