Insert into table from form - refresh form problem

wilow

Registered User.
Local time
Today, 13:58
Joined
Oct 23, 2012
Messages
14
Hi,

I have a some form.
And I wrote code that was inserted value to the table:
Code:
Private Sub dodaj_rekord_Click()

SQL = "INSERT INTO WSTAWIENIA(REFERENCJA, ILOSC, KTO) VALUES(" & Forms!WSTAWIENIA!referencja & "," & Forms!WSTAWIENIA!ilosc & "," & Forms!WSTAWIENIA!kto & ");"
DoCmd.RunSQL SQL

[SIZE=3][COLOR=Red][B]DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'problem line[/B][/COLOR][/SIZE]
 
End Sub
And question:
When I add data without line "problem line - comment", The data are added, but the form doesn't refresh the textbox. But when I add "problem line - comment", form is refresh but data are duplicated. I tried this code to last line in my code:
Code:
DoCmd.GoToRecord , , acNext
, and works the same as the previous(refresh form, but duplicated data)
 
Hello again :D
I'll try to explain again what I have a problem with.
I created a new form. I added a button that executes a sql insert:
Code:
SQL = "insert into test_numbers(test_number) values(" & Me.test_number & ");"
When I click "ADD" button the data is added to the table, but the text box doesn't clear and record numbers below don't change. I add the file.
 

Attachments

Why do you think the record numbers below should change?
You use a unbound form.
Why do you think the text box should clear?
It is unbound too!

Try form2 in the attached database, maybe it is what you want.
 

Attachments

Users who are viewing this thread

Back
Top Bottom