943,754 Members | Top Members by Rank

Ad:
Aug 30th, 2007
0

Adding new records automatically in Access

Expand Post »
OK, now this problem relates to the same one ive been having with the invoices, "Transfering records", that I posted.

If i have a text filed, lets say activity, which contains the user activity on a form, (Eg user clicks "Send Report" button and "activity" changes to "Report Sent" - this is basic and works OK) and a table for notes:

a - date/time - Date/Time
b - note - String
User - String

How can I add a record to the notes table if a user has caused the activity field to change. The event leading to the actual adding of the record i've got, but no more.
In the above eg for instance, the user clicked "Send Report" and activity changes to "Rerport Sent" i want the following record added to the Notes table:
Date/Time: Now() (Automatticaly by default Value)
Note: "Report Sent"
User: "System"

I cant seem to find a command that will enable me to add a record.

Ive managed to get the table/form to open in add mode, but the fields are not inserted automatically. I dont particularly like the table being opened, but if it works that 100%. The table then closed after the record has been added. This needs to be done in the back ground if possible, so that the user is not aware of the records.

Any ideas or directions???

Thanks,

J
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JaceDBN is offline Offline
11 posts
since Aug 2007
Aug 30th, 2007
0

Re: Adding new records automatically in Access

Hi,

You don't have to open nor a form or a table, just in the commandbutton that sends the report or do other actions add this statment:
DoCmd.RunSQL "INSERT INTO tblNotes ( NoteDate, NoteText, NoteUsr ) SELECT Now(), [Forms]![Form1]![txtAtv] , 'System'"
where txtAtv is the textbox that contains the activity.
Reputation Points: 13
Solved Threads: 29
Junior Poster
kb.net is offline Offline
169 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Retrieving MS Access records to ListView control
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Generate Primary Key in VB / Delete Record Status





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC