automatically record txtbox data to table

  • Thread starter Thread starter adriany
  • Start date Start date
A

adriany

i have 3 textbox in form1
txtbox1.defaultvalue = currentuser()
txtbox2.defaultvalue= date()
txtbox2.dfaultbalue= time()

I like to open form1 and Automatically sent txtbox1,2,3
data to table1. not sure how this can be done.

or anyone have better solution to look who's login in at
what date and time!

thanks all
 
Hi Adriany

If this is all you want to do then you don't need a form. Also, you don't
need separate fields for the date and the time, because a Date/Time field
holds both.

All you need is to execute a SQL command to append a new record to your
table - for example:
CurrentDb.Execute "Insert into tblSessionLog (UserID, LoginTime) " _
& "values ( CurrentUser(), Now() );", dbFailOnError
 
hey thanks for your solution i will try

one thing i didn't mention was i like this done when user
open menu form and form1, form2
-----Original Message-----
Hi Adriany

If this is all you want to do then you don't need a form. Also, you don't
need separate fields for the date and the time, because a Date/Time field
holds both.

All you need is to execute a SQL command to append a new record to your
table - for example:
CurrentDb.Execute "Insert into tblSessionLog (UserID, LoginTime) " _
& "values ( CurrentUser(), Now() );", dbFailOnError

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i have 3 textbox in form1
txtbox1.defaultvalue = currentuser()
txtbox2.defaultvalue= date()
txtbox2.dfaultbalue= time()

I like to open form1 and Automatically sent txtbox1,2,3
data to table1. not sure how this can be done.

or anyone have better solution to look who's login in at
what date and time!

thanks all


.
 
thanks Graham,

when you say SQL command to append a new record to your
table????

i don't understand,
do i include in vba @ form's event ? or what?

thanks again!
-----Original Message-----
Hi Adriany

If this is all you want to do then you don't need a form. Also, you don't
need separate fields for the date and the time, because a Date/Time field
holds both.

All you need is to execute a SQL command to append a new record to your
table - for example:
CurrentDb.Execute "Insert into tblSessionLog (UserID, LoginTime) " _
& "values ( CurrentUser(), Now() );", dbFailOnError

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i have 3 textbox in form1
txtbox1.defaultvalue = currentuser()
txtbox2.defaultvalue= date()
txtbox2.dfaultbalue= time()

I like to open form1 and Automatically sent txtbox1,2,3
data to table1. not sure how this can be done.

or anyone have better solution to look who's login in at
what date and time!

thanks all


.
 
The line of code I gave you (CurrentDb.Execute...) is VBA code which
executes a SQL command. You should put it in a procedure which is executed
when you want to create the record.

For example, if you want to create the record when your menu form opens,
then put the code in the Form_Load event procedure for that form.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


adriany said:
thanks Graham,

when you say SQL command to append a new record to your
table????

i don't understand,
do i include in vba @ form's event ? or what?

thanks again!
-----Original Message-----
Hi Adriany

If this is all you want to do then you don't need a form. Also, you don't
need separate fields for the date and the time, because a Date/Time field
holds both.

All you need is to execute a SQL command to append a new record to your
table - for example:
CurrentDb.Execute "Insert into tblSessionLog (UserID, LoginTime) " _
& "values ( CurrentUser(), Now() );", dbFailOnError

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

i have 3 textbox in form1
txtbox1.defaultvalue = currentuser()
txtbox2.defaultvalue= date()
txtbox2.dfaultbalue= time()

I like to open form1 and Automatically sent txtbox1,2,3
data to table1. not sure how this can be done.

or anyone have better solution to look who's login in at
what date and time!

thanks all


.
 
thanks again
-----Original Message-----
The line of code I gave you (CurrentDb.Execute...) is VBA code which
executes a SQL command. You should put it in a procedure which is executed
when you want to create the record.

For example, if you want to create the record when your menu form opens,
then put the code in the Form_Load event procedure for that form.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


thanks Graham,

when you say SQL command to append a new record to your
table????

i don't understand,
do i include in vba @ form's event ? or what?

thanks again!
-----Original Message-----
Hi Adriany

If this is all you want to do then you don't need a form. Also, you don't
need separate fields for the date and the time,
because
a Date/Time field
holds both.

All you need is to execute a SQL command to append a
new
record to your
table - for example:
CurrentDb.Execute "Insert into tblSessionLog (UserID, LoginTime) " _
& "values ( CurrentUser(), Now() );", dbFailOnError

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

"adriany" <[email protected]> wrote
in
message
i have 3 textbox in form1
txtbox1.defaultvalue = currentuser()
txtbox2.defaultvalue= date()
txtbox2.dfaultbalue= time()

I like to open form1 and Automatically sent txtbox1,2,3
data to table1. not sure how this can be done.

or anyone have better solution to look who's login
in
at
what date and time!

thanks all


.


.
 
Back
Top