Hi,
i'm working on a form with various unbound controls to deal with conversions; for instance the user chooses "M" or "F" but the record source in the table becomes "1" or "2".
When a user navigates through the records, i want the right information to be displayed on the form (M/F, not 1/2)
To do this I'm using Form_Current(); all works fine for 3 conversions until...i get 2110 error "can't activate control" when i add a 4th one. Well here's some code I use:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.telephone.visible=true
Me.Telephone.Setfocus
(...) 'same idea
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus 'Error is highlighted here
If Me.Nomdelavoie.Text Like "rue*" Then
(...)
End If
---
It is still a mystery to me...I deactivated Autocorrection of the control, used different names for the control and its source, tried "DoCmd.Gotocontrol" instead of "Setfocus"; the control is visible and enabled...nothing worked.
I also tried that code:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus 'No error!
Me.telephone.visible=true
Me.Telephone.Setfocus
(...) 'same idea
---
This works but is incomplete (no If..Then). And strangely, this doesn't work anymore:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus
If Me.Nomdelavoie.Text Like "rue*" Then
(...)
End If
Me.telephone.visible=true
Me.Telephone.Setfocus 'Error Here!!
(...) 'same idea
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus
---
I don't get it...can the If..Then be troublesome??!!
Any help would be appreciated; thanks in advance.
NB.: -version=Access2007
-i hope you understood it all...my english is perfectible
i'm working on a form with various unbound controls to deal with conversions; for instance the user chooses "M" or "F" but the record source in the table becomes "1" or "2".
When a user navigates through the records, i want the right information to be displayed on the form (M/F, not 1/2)
To do this I'm using Form_Current(); all works fine for 3 conversions until...i get 2110 error "can't activate control" when i add a 4th one. Well here's some code I use:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.telephone.visible=true
Me.Telephone.Setfocus
(...) 'same idea
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus 'Error is highlighted here
If Me.Nomdelavoie.Text Like "rue*" Then
(...)
End If
---
It is still a mystery to me...I deactivated Autocorrection of the control, used different names for the control and its source, tried "DoCmd.Gotocontrol" instead of "Setfocus"; the control is visible and enabled...nothing worked.
I also tried that code:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus 'No error!
Me.telephone.visible=true
Me.Telephone.Setfocus
(...) 'same idea
---
This works but is incomplete (no If..Then). And strangely, this doesn't work anymore:
---
Private Sub FormCurrent()
...
Me.sexe.visible=true
Me.sexe.Setfocus
If Me.sexe.Text="1" Then
Me.listesexe.Setfocus
Me.Listesexe="M"
If Me.sexe.Text="2" Then
Me.listesexe.Setfocus
Me.Listesexe="F"
Me.sexe.visible=False
'this works fine
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus
If Me.Nomdelavoie.Text Like "rue*" Then
(...)
End If
Me.telephone.visible=true
Me.Telephone.Setfocus 'Error Here!!
(...) 'same idea
Me.Nomdelavoie.visible=true
Me.Nomdelavoie.Setfocus
---
I don't get it...can the If..Then be troublesome??!!
Any help would be appreciated; thanks in advance.
NB.: -version=Access2007
-i hope you understood it all...my english is perfectible
