Hello,
I have big problem with vba code. I try to update table in my database with one of the forms. I have form called Insert Person on which I have 5 fields - name, surname, street, postal code and city. And below them a button "add person" coded with VB.
I don't know why the VB shows me an error "Object required".
Here's a code of the button:
Code:
Option Compare Database
Private Sub WstawBtn_Click()
On Error GoTo Err_WstawBtn_Click
Dim baza As DAO.Database
Dim rekord As DAO.Recordset
Set baza = CurrentDb()
Set rekord = db.OpenRecordset("Klienci", dbOpenDynaset)
Dim imieVar As String
Dim nazwiskoVar As String
Dim ulicaVar As String
Dim kodVar As String
Dim miejscowoscVar As String
imieVar = Me.ImieTxt
nazwiskoVar = Me.NazwiskoTxt
ulicaVar = Me.UlicaTxt
kodVar = Me.KodTxt
miejscowoscVar = Me.MiejscowoscTxt
rekord.AddNew
rekord![Imię] = imieVar
rekord![Nazwisko] = nazwiskoVar
rekord![Ulica] = ulicaVar
rekord![Kod_pocztowy] = kodVar
rekord![Miejscowość] = miejscowoscVar
rekord.Update
Exit_WstawBtn_Click:
Exit Sub
Err_WstawBtn_Click:
MsgBox Err.Description
Resume Exit_WstawBtn_Click
End Sub
Any help will be appreciated.. 