Hi everybody!
First I have to say that I´m from Austria, so I hope you understand that my English is not perfect. So please keep your answers in an understanding form. Thanks
Now my problem:
I want to dis/enable some textboxes. I use the selfwritten function ButtonsPerson. When I start my form, I get the runtime error number 13, "Typs are incompatible".
Here are some parts of my code, which should be enough for you guys, to recognize the problem.
Thank you again.
Slangly
First I have to say that I´m from Austria, so I hope you understand that my English is not perfect. So please keep your answers in an understanding form. Thanks
Now my problem:
I want to dis/enable some textboxes. I use the selfwritten function ButtonsPerson. When I start my form, I get the runtime error number 13, "Typs are incompatible".
Here are some parts of my code, which should be enough for you guys, to recognize the problem.
Thank you again.
Slangly
Code:
(global:)
Option Explicit
Option Compare Database
Dim rsFirma As New ADODB.Recordset
Dim rsPerson As New ADODB.Recordset
Dim cn As New ADODB.Connection
Private Sub Form_Load()
Set cn = CurrentProject.Connection
rsFirma.Open "firma", cn, adOpenStatic, adLockOptimistic, adCmdTableDirect
rsPerson.Open "person", cn, adOpenStatic, adLockOptimistic, adCmdTableDirect
rsFirma.Index = "PrimaryKey"
rsPerson.Index = "PrimaryKey"
DatenFirma
DatenPerson
End Sub
Private Function ButtonsPerson(ByVal Modus As String)
Dim Feld As Field
Dim Name As String
If (Modus = "Sperren") Then
For Each Feld In rsPerson.Fields
Name = "txtP" & Feld.Name
Forms("firma").Controls(Name).Enabled = False
Next
End If
If (Modus = "Freigeben") Then
For Each Feld In rsPerson.Fields
Name = "txtP" & Feld.Name
Forms("firma").Controls(Name).Enabled = True
Next
End If
End Function