Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

incompatibilité de type

3 réponses
Avatar
jfd
Bonsoir à tous
Je cherche depuis ce matin et je ne comprends pas une « incompatibilité de
type »
Si je fais :
Private Sub Form_Load()
If Me.Text800 = "1En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If
If Me.Text800 = "2En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If………………………………………..la suite……………………Tout est OK
Comment faire pour passer avec:
Private Sub Form_Load()
If Me.Text800 = "1En" Or "2En" Or "3En" Or "4En" Or "5En" Or "6En" Or
"7En" Or "8En" Or "9En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!Languages!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If………………………………………..la suite
Je tombe sur une incompatibilité de type et …………………….je comprends pas
Un coup de pouce serait le bienvenu en vous souhaitant un bon week-end à tous.
Merci par avance
jfd

3 réponses

Avatar
jfd
Pas encore compris le pourquoi donc remplacement par un :
Me!Text45 =
Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Text800,
"1", " "), "2", " "), "3", " "), "4", " "), "5", " "), "6", " "), "7", " "),
"7", " "), "8", " "), "9", " "), "0", " ")
pour simplifier la suite du code et en espérant que cela passe partout.
Bon week-end et restant à l’écoute de vos conseils.
jfd
Ouaiiiiiiiiiiiii un 7 de trop!!!!

"jfd" a écrit :

Bonsoir à tous
Je cherche depuis ce matin et je ne comprends pas une « incompatibilité de
type »
Si je fais :
Private Sub Form_Load()
If Me.Text800 = "1En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If
If Me.Text800 = "2En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If………………………………………..la suite……………………Tout est OK
Comment faire pour passer avec:
Private Sub Form_Load()
If Me.Text800 = "1En" Or "2En" Or "3En" Or "4En" Or "5En" Or "6En" Or
"7En" Or "8En" Or "9En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!Languages!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If………………………………………..la suite
Je tombe sur une incompatibilité de type et …………………….je comprends pas
Un coup de pouce serait le bienvenu en vous souhaitant un bon week-end à tous.
Merci par avance
jfd




Avatar
Michel__D
Bonjour,

jfd a écrit :
Bonsoir à tous
Je cherche depuis ce matin et je ne comprends pas une « incompatibilité de
type »
Si je fais :
Private Sub Form_Load()
If Me.Text800 = "1En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If
If Me.Text800 = "2En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!LanguageS!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If...............................................la suite........................Tout est OK
Comment faire pour passer avec:
Private Sub Form_Load()
If Me.Text800 = "1En" Or "2En" Or "3En" Or "4En" Or "5En" Or "6En" Or
"7En" Or "8En" Or "9En" Then
stDocName = "English macro3"
DoCmd.RunMacro stDocName
Forms!Languages!Combo22.ControlSource = "English"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Me.Form.Refresh
End If...............................................la suite
Je tombe sur une incompatibilité de type et .........................je comprends pas
Un coup de pouce serait le bienvenu en vous souhaitant un bon week-end à tous.
Merci par avance
jfd



Normal il y a un problème de syntaxe :

If Me.Text800 = "1En" Or "2En" Or ...

devrait s'écrire comme ceci :

If Me.Text800 = "1En" Or Me.Text800 = "2En" Or ...

Mais il existe d'autre façon de faire :

Soit avec un select case

ou autre solution dissocier le 1er caractère qui peut prendre les valeurs de
1 à 9 par rapport aux 2 autres caractères qui eux ne changent pas.
Avatar
jfd
Merci Michel
Encore beaucoup à apprendre, je vais regarder cela et essayer.
Bon dimanche
jfd

"Michel__D" a écrit :

Bonjour,

jfd a écrit :
> Bonsoir à tous
> Je cherche depuis ce matin et je ne comprends pas une « incompatibilité de
> type »
> Si je fais :
> Private Sub Form_Load()
> If Me.Text800 = "1En" Then
> stDocName = "English macro3"
> DoCmd.RunMacro stDocName
> Forms!LanguageS!Combo22.ControlSource = "English"
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
> Me.Form.Refresh
> End If
> If Me.Text800 = "2En" Then
> stDocName = "English macro3"
> DoCmd.RunMacro stDocName
> Forms!LanguageS!Combo22.ControlSource = "English"
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
> Me.Form.Refresh
> End If...............................................la suite........................Tout est OK
> Comment faire pour passer avec:
> Private Sub Form_Load()
> If Me.Text800 = "1En" Or "2En" Or "3En" Or "4En" Or "5En" Or "6En" Or
> "7En" Or "8En" Or "9En" Then
> stDocName = "English macro3"
> DoCmd.RunMacro stDocName
> Forms!Languages!Combo22.ControlSource = "English"
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
> Me.Form.Refresh
> End If...............................................la suite
> Je tombe sur une incompatibilité de type et .........................je comprends pas
> Un coup de pouce serait le bienvenu en vous souhaitant un bon week-end à tous.
> Merci par avance
> jfd

Normal il y a un problème de syntaxe :

If Me.Text800 = "1En" Or "2En" Or ...

devrait s'écrire comme ceci :

If Me.Text800 = "1En" Or Me.Text800 = "2En" Or ...

Mais il existe d'autre façon de faire :

Soit avec un select case

ou autre solution dissocier le 1er caractère qui peut prendre les valeurs de
1 à 9 par rapport aux 2 autres caractères qui eux ne changent pas.