FreonIceMan
Registered User.
- Local time
- Today, 07:26
- Joined
- May 31, 2011
- Messages
- 19
I have created a database using Access 2010 32 bit. It worked fine until I split the database. The problem was that I had a macro referencing a data Macro attached to a table in the database.
Now I have one function that will not work the way I want to, I have looked around the internet to fix the problem and this is far as I have gotten.
What I was to to happen is when I click my save button is my Comments table has an entry added with the current record's ID "ContactID", the comment that is entered in "txtAddComment", and the current date and time. After that is entered I would like the "txtAddComment" to clear and the form to update or specifically the sub form "sfrComments" to update to show the new entry. I would also like it to not make an entry if there is nothing in "txtAddComment".
So far I have been able to get the entry to happen. Below is my code any help would be much appreciated. I have no experience in VBA other than what I figured out from the internet.
Now I have one function that will not work the way I want to, I have looked around the internet to fix the problem and this is far as I have gotten.
What I was to to happen is when I click my save button is my Comments table has an entry added with the current record's ID "ContactID", the comment that is entered in "txtAddComment", and the current date and time. After that is entered I would like the "txtAddComment" to clear and the form to update or specifically the sub form "sfrComments" to update to show the new entry. I would also like it to not make an entry if there is nothing in "txtAddComment".
So far I have been able to get the entry to happen. Below is my code any help would be much appreciated. I have no experience in VBA other than what I figured out from the internet.
Private Sub cmdSave_Click()
Dim dbNPVdB As DAO.Database
Dim rstComments As DAO.Recordset
Set dbNPVdB = CurrentDb
Set rstComments = dbNPVdB.OpenRecordset("Comments")
rstComments.AddNew
rstComments("CommentDate").Value = Now()
rstComments("Comment").Value = [txtAddComment]
rstComments("ContactID").Value = [txtID]
rstComments.Update
End Sub