When I select one field the other fields are displayed. (1 Viewer)

milly62

New member
Local time
Today, 06:55
Joined
Feb 17, 2020
Messages
13
I would like to help someone solve the following problem.
When I select one field the other fields are displayed.
See the pictures attached.

Thanks in advance
 

Attachments

  • 2020-03-25_10-43-01.png
    2020-03-25_10-43-01.png
    44.5 KB · Views: 112

jdraw

Super Moderator
Staff member
Local time
Yesterday, 23:55
Joined
Jan 23, 2006
Messages
15,379
We need more info. My suspicion is that you are using lookups in the table field definition. Please show us table definitions and any code related to the picture you posted.
 

cheekybuddha

AWF VIP
Local time
Today, 04:55
Joined
Jul 21, 2014
Messages
2,280
What are the names of the controls?

You have:
checkbox
combobox
textbox
 

cheekybuddha

AWF VIP
Local time
Today, 04:55
Joined
Jul 21, 2014
Messages
2,280
Also, is the checkbox bound to a field in the form's RecordSource?
 

milly62

New member
Local time
Today, 06:55
Joined
Feb 17, 2020
Messages
13
My code is
Private Sub CheckBoxName_AfterUpdate()

With Me
.FirstTextBoxName.Visible = .CheckBoxName
.SecondTextBoxName.Visible = .CheckBoxName
End With

End Sub
 

Attachments

  • table.png
    table.png
    29.7 KB · Views: 90

Micron

AWF VIP
Local time
Yesterday, 23:55
Joined
Oct 20, 2018
Messages
3,478
If by "When I select one field the other fields are displayed" if the "one" field is the checkbox, it seems it will do exactly what you want so I don't see what the problem is. If by "one" field you mean one of the textboxes then you must have code on one or both of those textboxes and it's interfering with your desired result. The problem isn't clear.
 

Micron

AWF VIP
Local time
Yesterday, 23:55
Joined
Oct 20, 2018
Messages
3,478
then you must have code on one or both of those textboxes and it's interfering with your desired result.
I hope you didn't think I meant "you must have" to mean you need to add something. I meant it is a possible reason for why it would not be functioning correctly if that's the case. For me, I still don't understand what the problem is, or even if there is one.
 

zeroaccess

Active member
Local time
Yesterday, 22:55
Joined
Jan 30, 2020
Messages
671
SQL:
FirstTextBoxName.Visible = (CheckBoxName = True)
SecondTextBoxName.Visible = (CheckBoxName = True)

Or

SQL:
Select Case True
    Case CheckBoxName = True
        Me.FirstTextBoxName.Visible = True
        Me.SecondTextBoxName.Visible = True
    Case CheckBoxName = False
        Me.FirstTextBoxName.Visible = False
        Me.SecondTextBoxName.Visible = False
    End Select
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:55
Joined
May 7, 2009
Messages
19,243
the code you posted on post#5 will work.
if the checkbox is bound, then you need to add code to the
Current Event of the form to automatically show/hide the 2 textboxes:
Code:
Private Sub Form_Current()
Me.CheckboxName.SetFocus
Call CheckboxName_AfterUpdate()
End Sub
 

milly62

New member
Local time
Today, 06:55
Joined
Feb 17, 2020
Messages
13
Here is my form with problems.
It is in romanian language.
 

Attachments

  • DatabaseTEST.zip
    128.1 KB · Views: 99

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:55
Joined
May 7, 2009
Messages
19,243
cannot edit form without getting error ('coz of extendend character sets on your control name):
add code to AfterUpdate event of checkbox (Bifare191).
add code to the Form's Current event:
Code:
Private Sub Bifare191_AfterUpdate()
'Bifare191
With Me
    .Controls("Etichetã194").Visible = Nz(.Controls("Bifare191").Value, 0)
    .Controls("Etichetă196").Visible = Nz(.Controls("Bifare191").Value, 0)

    .Controls("Combo193").Visible = Nz(.Controls("Bifare191").Value, 0)
    .Controls("Text195").Visible = Nz(.Controls("Bifare191").Value, 0)
End With
End Sub

Private Sub Form_Current()
    Dim strControlName As String
  
    strControlName = "~"
    On Error Resume Next
    strControlName = Me.ActiveControl.Name
  
    If InStr("/Combo193/Text195/", strControlName) > 0 Then
        Me.Controls("Bifare191").SetFocus
  
    End If
  
    Call Bifare191_AfterUpdate
  
End Sub
 

milly62

New member
Local time
Today, 06:55
Joined
Feb 17, 2020
Messages
13
Private Sub Bifare191_AfterUpdate() 'Bifare191 With Me .Controls("Etichetã194").Visible = Nz(.Controls("Bifare191").Value, 0) .Controls("Etichetă196").Visible = Nz(.Controls("Bifare191").Value, 0) .Controls("Combo193").Visible = Nz(.Controls("Bifare191").Value, 0) .Controls("Text195").Visible = Nz(.Controls("Bifare191").Value, 0) End With End Sub Private Sub Form_Current() Dim strControlName As String strControlName = "~" On Error Resume Next strControlName = Me.ActiveControl.Name If InStr("/Combo193/Text195/", strControlName) > 0 Then Me.Controls("Bifare191").SetFocus End If Call Bifare191_AfterUpdate End Sub


I do, but see attachment 1, 2 and 3
 

Attachments

  • 2.png
    2.png
    13.2 KB · Views: 90
  • 3.png
    3.png
    14 KB · Views: 99
  • 11111111111111111.png
    11111111111111111.png
    50.2 KB · Views: 90

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:55
Joined
May 7, 2009
Messages
19,243
you must edit the db using the Language where the db is created.
 

Users who are viewing this thread

Top Bottom