Hey guys,
I try it again.
I have a string I get from outlook with the hole name (fist name, sure name) and I want to split it into two fields.
actually it works, but the UPDATE of the database won´t work. could you take a look please?
Code:
Option Compare DatabaseOption Explicit
Private Sub Befehl9_Click()
Dim db As DAO.Database
Dim strGlatt
Dim strLaenge
Dim strPosLeer
Dim strLinkeSeite
Dim strRechteSeite
Dim strSQL
Dim strID As Byte
Set db = CurrentDb
strID = Me.ID
Debug.Print "die ID ist: " & strID
strGlatt = Trim$(Me.ganzerName)
strLaenge = Len(strGlatt)
Debug.Print "gesamtlänge: " & strLaenge
strPosLeer = InStr(strGlatt, " ")
Debug.Print "Position Leerzeichen: " & strPosLeer
strLinkeSeite = Left(strGlatt, strPosLeer - 1)
Debug.Print "Linker Name: " & strLinkeSeite
strRechteSeite = Right(strGlatt, strLaenge - strPosLeer)
Debug.Print "Rechter Name: " & strRechteSeite
db.Execute ("UPDATE Tabelle1 SET Vorname = '" & strLinkeSeite & "', Nachname = '" & strRechteSeite & "' WHERE ID = strID")
Forms![formTabelle1].Requery
End Sub
I think the proleme is the WHERE part, isn´t so?
thx