Adding new records automatically in Access

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2007
Posts: 11
Reputation: JaceDBN is an unknown quantity at this point 
Solved Threads: 0
JaceDBN's Avatar
JaceDBN JaceDBN is offline Offline
Newbie Poster

Adding new records automatically in Access

 
0
  #1
Aug 30th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Adding new records automatically in Access

 
0
  #2
Aug 30th, 2007
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.
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 4158 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC