Hallo und schön wieder von dir zu hören Armin ;)
Beide Varianten geben Fehlermeldungen. wie wars anders zu erwarten
1. Variante :" Sie haben einen Ausdruck eingegeben, der keinen Wert hat.@Der Ausdruck bezieht sich möglicherweise auf ein Objekt, das keinen Wert zurückgibt (z.B. ein Formular, ein Bericht oder ein Bezeichnungsfeld-Steuerelement)."
DoCmd.OpenForm "Formular3", acNormal, "", "", , acNormal
Form_Formular3.Visible = False
Form_Formular1.Befehl701.ForeColor = RGB(128, 0, 0)
Form_Formular3.Textfeld1.SetFocus
If Not Form_Formular3. Textfeld1 = "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
Form_Formular3. Textfeld2.SetFocus
If Not Form_Formular3. Textfeld 2 = "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
Form_Formular3. Textfeld3.SetFocus
If Not Form_Formular3. Textfeld3 = "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
Form_Formular3. Textfeld4.SetFocus
If Not Form_Formular3. Textfeld4 = "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
Form_Formular3. Textfeld5.SetFocus
If Not Form_Formular3. Textfeld5= "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
Form_Formular3. Textfeld6.SetFocus
If Not Form_Formular3. Textfeld6 = "" Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
End If
DoCmd.Close acForm, "Formular3"
2. Variante: " variable nicht definiert" (Markiert zuerst Textfeld1)
DoCmd.OpenForm "Formular3", acNormal, "", "", , acNormal
Form_Formular3.Visible = False
Dim rs As Recordset
Set rs = Forms.Formular3.Recordset
If Not IsNull(rs(Textfeld1)) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
ElseIf Not IsNull(rs(Textfeld2)) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
ElseIf Not IsNull(rs(Textfeld3)) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
ElseIf Not IsNull(rs(Textfeld4 )) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
ElseIf Not IsNull(rs(Textfeld5)) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
ElseIf Not IsNull(rs(Textfeld6)) Then
Form_Formular1.Befehl701.ForeColor = RGB(0, 128, 255)
Else
Form_Formular1.Befehl701.ForeColor = RGB(255, 0, 0)
End If
DoCmd.Close acForm, "Formular3"
Ich denke mal bei der zweiten spreche ich das RS falsch an?
Und bei der ersten ist ja der selbe Fehler wie immer, der anscheinend auch dadruch nicht wegzubekommen ist, also vielleicht sollten wir uns lieber auf die Recordset Variante fokussieren
Gruß und danke für die Geduld
t?tet keine v?gel, wir v?geln auch keine toten!  |