I 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.
23 3792
I 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.
Hi. Are you thinking about a form?
Hi. Are you thinking about a form?
Yes its a form with many fields Field1 and Field2 are the last two fields in the form.
Yes its a form with many fields Field1 and Field2 are the last two fields in the form.
Then you can make field1 an option group with two radio buttons. When no is selected, as by default, you can make field2 either invisible:
or you can disable Field2 so that it is visible and cannot be used
Then you can make field1 an option group with two radio buttons. When no is selected, as by default, you can make field2 either invisible ...
or you can disable Field2 so that it is visible and cannot be used
Seems as though a checkbox would be appropriate for Field1, though radio buttons work too.
Ok so how do I do this? All I want is the first field to be visible and defaulted to "No" and the second field to be invisible by default but if the first field is "Yes" I want it to appear and become mandatory.
I created the fields so lets assume I have Field1 and Field2 what would be the code and where do I enter it? I know how to get to event procedure and all.
Let me know guys, thanks!
Ok so how do I do this? All I want is the first field to be visible and defaulted to "No" and the second field to be invisible by default but if the first field is "Yes" I want it to appear and become mandatory.
I created the fields so lets assume I have Field1 and Field2 what would be the code and where do I enter it? I know how to get to event procedure and all.
Let me know guys, thanks!
Seems like you have ignored the answers above.
What does mandatory mean?
I didn't ignore the answers I plugged them in the code but it did nothing
Mandatory meaning that I have to chose one of the options in Field2 in order to continue to next client.
I didn't ignore the answers I plugged them in the code but it did nothing
Mandatory meaning that I have to chose one of the options in Field2 in order to continue to next client.
OK. Could you post your code with the plugged in items included please?
I will pm you the code
Please do not pm code. It is not useful to others who want to learn from solutions to problems. -
Option Compare Database
-
-
-
Private Sub ContactTypeID_NotInList(NewData As String, Response As Integer)
-
MsgBox "Double-click this field to add an entry to the list."
-
Response = acDataErrContinue
-
End Sub
-
Private Sub ContactTypeID_DblClick(Cancel As Integer)
-
On Error GoTo Err_ContactTypeID_DblClick
-
Dim lngContactTypeID As Long
-
-
If IsNull(Me![ContactTypeID]) Then
-
Me![ContactTypeID].Text = ""
-
Else
-
lngContactTypeID = Me![ContactTypeID]
-
Me![ContactTypeID] = Null
-
End If
-
DoCmd.OpenForm "Contact Types", , , , , acDialog, "GotoNew"
-
Me![ContactTypeID].Requery
-
If lngContactTypeID <> 0 Then Me![ContactTypeID] = lngContactTypeID
-
-
Exit_ContactTypeID_DblClick:
-
Exit Sub
-
-
Err_ContactTypeID_DblClick:
-
MsgBox Err.Description
-
Resume Exit_ContactTypeID_DblClick
-
End Sub
-
Private Sub Calls_Click()
-
On Error GoTo Err_Calls_Click
-
If IsNull(Me![ContactID]) Then
-
MsgBox "Enter contact information before making a call."
-
Else
-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
-
DoCmd.OpenForm "Calls"
-
End If
-
-
Exit_Calls_Click:
-
Exit Sub
-
-
Err_Calls_Click:
-
MsgBox Err.Description
-
Resume Exit_Calls_Click
-
End Sub
-
Private Sub Dial_Click()
-
On Error GoTo Err_Dial_Click
-
-
Dim strDialStr As String
-
Dim ctlPrevCtl As Control
-
Const ERR_OBJNOTEXIST = 2467
-
Const ERR_OBJNOTSET = 91
-
-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
-
-
Set ctlPrevCtl = Screen.PreviousControl
-
-
If TypeOf ctlPrevCtl Is TextBox Then
-
strDialStr = IIf(VarType(ctlPrevCtl) > V_NULL, ctlPrevCtl, "")
-
ElseIf TypeOf ctlPrevCtl Is ListBox Then
-
strDialStr = IIf(VarType(ctlPrevCtl) > V_NULL, ctlPrevCtl, "")
-
ElseIf TypeOf ctlPrevCtl Is ComboBox Then
-
strDialStr = IIf(VarType(ctlPrevCtl) > V_NULL, ctlPrevCtl, "")
-
Else
-
strDialStr = ""
-
End If
-
-
Application.Run "utility.wlib_AutoDial", strDialStr
-
-
Exit_Dial_Click:
-
Exit Sub
-
-
Err_Dial_Click:
-
If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Then
-
Resume Next
-
End If
-
MsgBox Err.Description
-
Resume Exit_Dial_Click
-
End Sub
-
Private Sub Page1_Click()
-
Me.GoToPage 1
-
End Sub
-
Private Sub Page2_Click()
-
Me.GoToPage 2
-
End Sub
-
-
Private Sub Client_First_Name_AfterUpdate()
-
Me![UKey] = Right(Year(Now()), 2) + Nz(DCount("*", "Case#", "UKey Like '" + Right(Year(Now()), 2) + "*'")) + 1
-
End Sub
-
-
Private Sub cmdFind_Click()
-
-
-
Me.Recordset.FindFirst "[Client LN] = " & Nz(Me!txtIdFind, 0)
-
-
End Sub
-
-
-
-
Private Sub Is_the_case_workers_comp__BeforeUpdate(Cancel As Integer)
-
Workers_Comp_Atty.Visible = False
-
End Sub
-
-
Private Sub The_date_of_occurence_AfterUpdate()
-
Me![SOL 1] = DateAdd("yyyy", 1, Me![The_date_of_occurence])
-
Me![SOL 2] = DateAdd("yyyy", 2, Me![The_date_of_occurence])
-
Me![SOL 6M] = DateAdd("m", 6, Me![The_date_of_occurence])
-
End Sub
-
Private Sub Find_Click()
-
On Error GoTo Err_Find_Click
-
-
-
Screen.PreviousControl.SetFocus
-
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
-
-
Exit_Find_Click:
-
Exit Sub
-
-
Err_Find_Click:
-
MsgBox Err.Description
-
Resume Exit_Find_Click
-
-
End Sub
-
Your code shows no sign of my suggestions being plugged in.
Would you kindly explain to us what is going on in this routine - Private Sub Client_First_Name_AfterUpdate()
-
Me![UKey] = Right(Year(Now()), 2) + Nz(DCount("*", "Case#", "UKey Like '" + Right(Year(Now()), 2) + "*'")) + 1
-
End Sub
PEB 1,418
Expert 1GB
Ok so how do I do this? All I want is the first field to be visible and defaulted to "No" and the second field to be invisible by default but if the first field is "Yes" I want it to appear and become mandatory.
I created the fields so lets assume I have Field1 and Field2 what would be the code and where do I enter it? I know how to get to event procedure and all.
Let me know guys, thanks!
Hi Cyber,
So for:
All I want is the first field to be visible and defaulted to "No" and the second field to be invisible by default
1.You create ur Field1 and Field2 As Killer suggests you as checkbox or Radio boutons
2.U click on Field1 and open the control properties
3.In the properties form u set up the default Value property to No
4.U cklick on Field2 an open the control properties
5.U set up the Visible property to False
For this part it's all!
if the first field is "Yes" I want it to appear and become mandatory.
For this part:
1.You click on Field1
2.Open the control properties
3.Go onClick property and assign event procedure
4.Type there in the white window: -
Me!Field2.Visible=Me!Field1
-
5.And ur Field2 appears or disapears in function of the value of Field1
Have a very happy new year's eve man!
and very happy year!
PEB 1,418
Expert 1GB
Please do not pm code. It is not useful to others who want to learn from solutions to problems.
Your code shows no sign of my suggestions being plugged in.
Would you kindly explain to us what is going on in this routine - Private Sub Client_First_Name_AfterUpdate()
-
Me![UKey] = Right(Year(Now()), 2) + Nz(DCount("*", "Case#", "UKey Like '" + Right(Year(Now()), 2) + "*'")) + 1
-
End Sub
This is generation of number!
that gets last numbers from the current year,
than gets what is the count of the respective key for the current year and adds 1
:)
This is generation of number!
that gets last numbers from the current year,
than gets what is the count of the respective key for the current year and adds 1
:)
Oh dear Mr PEB
I do not want to know what this code snippet does. I can see that for myself. I wanted to know if cyberdyne wrote this code or not. I have my doubts
Anyway, PEB, now that you have started I will gladly leave this with you and you can write the validation code to make field2 mandatory.
Have fun :)
Hey Guys, the code is cool, I love it when PEB explains things its so straightforward!
Willa the year generation code is to calculate the statue of limitations so once I enter data like 01.01.2007 the statue of limitations for one year will automatically show 01.01.2008 Code was written by PEB because he has been helping me in this first project in access.
Thanks for your help I will try the code and tell you if it works.
Best luck to you all.
Cyberdyne.
How do I make row source appear in my checkbox?
NeoPa 32,556
Expert Mod 16PB
What do you mean Cyber?
Are you referring to the 'Control Source' by any chance?
Ok 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
Ok 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
My guess is you will just need to code that yourself. Probably something like... - 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
My guess is you will just need to code that yourself. Probably something like... - 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?
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?
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.
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.
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?
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"
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.
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: - 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
then put this on AfterUpdate event of Field2: - If not isnull(me.field2) then
-
' enable and unlock the rest of the fields
-
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.
HTH,
George
I 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.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: MT |
last post by:
Hi all, this sounds like an easy enough thing to do, but after
spending 45 minutes searching google and various javascript sites I
can't find out how to make a textfield (textbox or whatever you...
|
by: Dilip |
last post by:
hi all ,
i m trying to make such a tree view which specify some
folder structure for installation
i mean there is some folders mandatory. This is installation software.
is based upon user...
|
by: danibecr |
last post by:
Hello all,
I have a form that contains a remarks field for user input and a checkbox for out of compliance orders. I need to make the remarks field mandatory after the checkbox is checked. Right...
|
by: plumba |
last post by:
Hi
I have a user enolment form which is users fill out to let IT know that they need setting up on 'x' systems. When the user put a cross in the 'I would like Email' checkbox I would like the...
|
by: AR123 |
last post by:
The mandatory form field that is not working is the TYPE OF ILLUSTRATION.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Proforma</title>
<meta...
|
by: AR123 |
last post by:
Hi I have set up a form. What I want to to is with the fields:
Company Postcode
Agency Number
Policy Number
I want these to be mandatory however if someone fills in the company postcode for...
|
by: Gaurav Jhamb |
last post by:
I have 2-3 forms.On my first form when i serach to put any word it sends results and after that i click on new button in my search i got different organisation names. on the secong form i passed the...
|
by: sva0008 |
last post by:
Hi ,
I have a scenario in which i have four input fields in asp with the same name batchlist.
I have a button called add batch .
The user can add the batch by clicking the add batch button . out...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |