Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP ! Posting to log file.

Status
Not open for further replies.

rfhall3

Programmer
Feb 7, 2003
28
US
I have a pretty straight forward situation. Basic visitor login scenario.

My form validates info in an existing table (visitor names) and has another unbound field for input (destination). When all fields are complete, user will press a button to add the record to the log table (there in my problem). Total fields used is 4 (date, time, info from input table, unbound field from form). When rec is written to the log/arch table, the cycle starts back over.

I know this could be done writing to a flat file, but will need to do reporting on it later.

What is the simplest method to log/archive these transactions to a table for later process/reporting. (I am comfortable using VBA, just real sketchy on the many different DB formats).

Thanks you very much.

Bobby
 
How are ya rfhall3 . . .

All you need is a properly setup [blue]append[/blue] query or SQL! . . . On a one to one basis. post back the transfer as follows:

LogTableName.PrimaryKeyName = Your Expression!
LogTableName.DateFieldName = Date()
LogTableName.TimeFieldName = Time()
LogTableName.Info = Me!InfoFieldName
LogTableName.UnbounfFieldName = me!UnboundFieldName

Calvin.gif
See Ya! . . . . . .
 
AceMan1 ...

Thanks for the reply. I understand assigning the values to the table. The problem is that I don't know how to code such a query (and more important, WHY it works) or using SQL. I do know how to update the current table attached to the current form, but it's adding a new record in a totally different table that I don't understand.

Anything you can offer is appreciated !

Thanks again,

Bobby
 
rfhall3 . . .

No problrmo! . . . just post back what I ask for! . . . if this is a problem let me know and I'll step ya thru it! . . .

Calvin.gif
See Ya! . . . . . .
 
Sorry, I didn't catch what you were asking for. The VisRegulars primary key is VisRegulars.Regulars. The primary key for the VisLog table is VisLog.Num. This is an autonumber field.
[red]
VisLog.Num = [/red][green](not sure how to select next sequence number)[/green][red]
VisLog.VisDate = Date()
VisLog.VisTime = Time()
VisLog.VisLast = VisRegulars.Regulars
VisLog.VisFirst = Null
VisLog.VisDestination = Me!VisitorDestination
[/red]
I did find a reference to an SQL command that appeared to do what I was looking for. Just for grins, I listed it below. This was to be used in VBA based on an "On Click" action from a form. I suspect the use of " and ' are all messed up in the this code.
[red]
DoCmd.RunSQL "Insert INTO 'VisLog"\' (Num, Date, Time, ResidentLast, ResidentFirst, Destination) VALUES ('999', '10/01/2006', '21.43', 'Schmidt Florist','','Intensive Care Unit')"
[/red]
Thank you for your continued attempts to help me !

Bobby
 
First, why having TWO fields to store a SINGLE DateTime value ?
In VisLog, Num should be an AutoNumber.
In your form you should have a TextBox populated with the value of VisRegulars.Regulars.
Code:
DoCmd.RunSQL "INSERT INTO VisLog(DateTime,VisLast,VisDestination)" _
 & " VALUES (#" & Format(Now, "yyyy-mm-dd hh:nn:ss") & "#" _
 & ",'" & Me![Regulars textbox] & "','" & Me!VisitorDestination & "')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank You.
Works great. That was just what I needed !
Bobby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top