Picasso_ss
New member
- Local time
- Today, 16:39
- Joined
- Jun 27, 2007
- Messages
- 4
Hello, (the code is at the end of the post)
I'm a total newbie with access and vba. Please help with a solution for my problem. This is the code i use in my application, but everytime I click the buton Save it creates a new line in the test table. Please help with a code that inserts a new record in the test table only when entering for the first time the form, and to perform the update whenever the value on Forms![Client]![Nume] is changed.
Example: When entering the form Client, the default value for Nume is 0. I must then enter a value for Nume. After i entered the value, I must click the buton Save, then the code insert a new line in table TEST, but when I modify the value and press for the second time the buton SAVE I don't want to create a new line in table test, but to update the last value entered. If the form is empty and want to enter a new value that is different from the last entered, the code must permit to create new lines, but if the value enered is already entered it must promt me about this.
Private Sub Save_Click()
DoCmd.SetWarnings (False)
DoCmd.RunSQL "INSERT INTO TEST ( [Nume1] ) SELECT Forms![Client]![Nume];"
DoCmd.SetWarnings (True)
MsgBox "Ai reusit", vbExclamation, "S-a facut salvarea"
End Sub
Thank you very much.
I'm a total newbie with access and vba. Please help with a solution for my problem. This is the code i use in my application, but everytime I click the buton Save it creates a new line in the test table. Please help with a code that inserts a new record in the test table only when entering for the first time the form, and to perform the update whenever the value on Forms![Client]![Nume] is changed.
Example: When entering the form Client, the default value for Nume is 0. I must then enter a value for Nume. After i entered the value, I must click the buton Save, then the code insert a new line in table TEST, but when I modify the value and press for the second time the buton SAVE I don't want to create a new line in table test, but to update the last value entered. If the form is empty and want to enter a new value that is different from the last entered, the code must permit to create new lines, but if the value enered is already entered it must promt me about this.
Private Sub Save_Click()
DoCmd.SetWarnings (False)
DoCmd.RunSQL "INSERT INTO TEST ( [Nume1] ) SELECT Forms![Client]![Nume];"
DoCmd.SetWarnings (True)
MsgBox "Ai reusit", vbExclamation, "S-a facut salvarea"
End Sub
Thank you very much.