saving information into a tables

G

GlobalTek

I have a form to select language ( 2 button, 1 french, 1 english ). Hidden on
the form his 2 text box that contain the following code =date & the other one
his =fOSUserName(). When 1 user open the form the information of the date and
the username log on windows appear in this 2 text box. I would like to be
able to save this info inside a table for further refenrence. how can I
proceed to make this happen ???
 
A

Albert D. Kallal

Simply make sure the form is bound to a table.

You can use that function name as the "default" setting for the control on
the text box.

If the form is bound..then when you close it, the values will be saved. You
don't even need to write code for this...
 
G

GlobalTek

I may be wrong but to bound a form to a table without saving you need to have
a combo-box. In my form I have a Text Box with a Default Value and I`m unable
to be able to save the information inside the table ... What other solution
can we use for that ???

Regards
 
J

John Vinson

I may be wrong but to bound a form to a table without saving you need to have
a combo-box. In my form I have a Text Box with a Default Value and I`m unable
to be able to save the information inside the table ... What other solution
can we use for that ???

Ummm...

You are in fact wrong.

It's perfectly possible to have a bound form without a combo box, or
an unbound form with a combo box. I have NO trace of an idea what you
mean by "bound a form to a table without saving" though.

Having a Default Value on an unbound textbox does exactly NOTHING
unless you have VBA code to open a Recordset based on a table, and
explicitly populate the Recordset with the value from the form - a
much more complex process than simply using a bound form!

John W. Vinson[MVP]
 
G

GlobalTek

Oh ok hehe Thanks for the info

Well I have a form that ask the user for Language selection ( french or
English )
Hide in that form his 3 Text Box, 1 will say the username of the person (
=fosusername() ) the second text box will say the machine name (
=fOSMachineName() ) and the last one will promt the date the form was open (
=now() ) I would like that info to be saved inside a table to know who is
accessing the file in case they is some problem. I tried the thing below and
It did not work, Anyone can tell me or help me resolving the problem please?
 
J

John Vinson

Oh ok hehe Thanks for the info

Well I have a form that ask the user for Language selection ( french or
English )
Hide in that form his 3 Text Box, 1 will say the username of the person (
=fosusername() ) the second text box will say the machine name (
=fOSMachineName() ) and the last one will promt the date the form was open (
=now() ) I would like that info to be saved inside a table to know who is
accessing the file in case they is some problem. I tried the thing below and
It did not work, Anyone can tell me or help me resolving the problem please?

ok...

Open a recordset based on the Table and add a new record, setting its
fields to the desired values.

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("YourLogTable", dbOpenDynaset, dbSeeChanges)
rs.AddNew
rs!Username = fosusername() ' or use the control name
rs!Machinename = fOSMachinename()
rs!WhenOpened = Now
rs.Update
rs.Close
Set rs = Nothing


John W. Vinson[MVP]
 
M

Marshall Barton

GlobalTek said:
Well I have a form that ask the user for Language selection ( french or
English )
Hide in that form his 3 Text Box, 1 will say the username of the person (
=fosusername() ) the second text box will say the machine name (
=fOSMachineName() ) and the last one will promt the date the form was open (
=now() ) I would like that info to be saved inside a table to know who is
accessing the file in case they is some problem. I tried the thing below and
It did not work, Anyone can tell me or help me resolving the problem please?


It sounds like you are using those expressions in the text
box's ControlSource instead of the DefaultValue. The
ControlSource should have the name of the field in the
table.

Remember that the DefaultValue is only used when you create
a new record. It has no effect on existing records.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top