sending data from my text box to my table

J

jmo

im using access 2003, i have a login form where users login with a user name
and password...they log into a Input QC form, from here they enter data then
add record and the data is moved to the Input QC table. I have a subform
setup in the Input QC form so the user can see the data being entered into
the table. I set up a text box using this code (=[Forms]![Login Form]![User
Log In]) im able to bring the user name from the log in form into the input
qc form but i cant seem to get the user name to pass through to the table
with each add record so i can query off user name. any help or ideas
 
D

Douglas J. Steele

Put code in the form's BeforeUpdate event to populate the field in the
form's recordset. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!UserName = [Forms]![Login Form]![User Log In]

End Sub

It's not even necessary for the UserName field to be visible on the form.
 
J

jmo

Hi Douglas, so is doing this going to keep me from putting code into the
control source, then i will be able to use my table field User Name. i still
trying to get your code to work for me and wanted to make sure i didnt need
to do anything to the control source.
--
Jeremy Morton


Douglas J. Steele said:
Put code in the form's BeforeUpdate event to populate the field in the
form's recordset. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!UserName = [Forms]![Login Form]![User Log In]

End Sub

It's not even necessary for the UserName field to be visible on the form.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jmo said:
im using access 2003, i have a login form where users login with a user
name
and password...they log into a Input QC form, from here they enter data
then
add record and the data is moved to the Input QC table. I have a subform
setup in the Input QC form so the user can see the data being entered into
the table. I set up a text box using this code (=[Forms]![Login
Form]![User
Log In]) im able to bring the user name from the log in form into the
input
qc form but i cant seem to get the user name to pass through to the table
with each add record so i can query off user name. any help or ideas
 
D

Douglas J. Steele

There should be no need to put code into the control source of the field.

If you want to display the user name, you could put code in the form's
Current event to initialize the field's value, rather than setting its
control source:

Private Sub Form_Current()

If Me.NewRecord Then
Me!UserName = [Forms]![Login Form]![User Log In]
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jmo said:
Hi Douglas, so is doing this going to keep me from putting code into the
control source, then i will be able to use my table field User Name. i
still
trying to get your code to work for me and wanted to make sure i didnt
need
to do anything to the control source.
--
Jeremy Morton


Douglas J. Steele said:
Put code in the form's BeforeUpdate event to populate the field in the
form's recordset. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!UserName = [Forms]![Login Form]![User Log In]

End Sub

It's not even necessary for the UserName field to be visible on the form.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jmo said:
im using access 2003, i have a login form where users login with a user
name
and password...they log into a Input QC form, from here they enter data
then
add record and the data is moved to the Input QC table. I have a
subform
setup in the Input QC form so the user can see the data being entered
into
the table. I set up a text box using this code (=[Forms]![Login
Form]![User
Log In]) im able to bring the user name from the log in form into the
input
qc form but i cant seem to get the user name to pass through to the
table
with each add record so i can query off user name. any help or ideas
 
J

jmo

worked...thanks
--
Jeremy Morton


Douglas J. Steele said:
There should be no need to put code into the control source of the field.

If you want to display the user name, you could put code in the form's
Current event to initialize the field's value, rather than setting its
control source:

Private Sub Form_Current()

If Me.NewRecord Then
Me!UserName = [Forms]![Login Form]![User Log In]
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jmo said:
Hi Douglas, so is doing this going to keep me from putting code into the
control source, then i will be able to use my table field User Name. i
still
trying to get your code to work for me and wanted to make sure i didnt
need
to do anything to the control source.
--
Jeremy Morton


Douglas J. Steele said:
Put code in the form's BeforeUpdate event to populate the field in the
form's recordset. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!UserName = [Forms]![Login Form]![User Log In]

End Sub

It's not even necessary for the UserName field to be visible on the form.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


im using access 2003, i have a login form where users login with a user
name
and password...they log into a Input QC form, from here they enter data
then
add record and the data is moved to the Input QC table. I have a
subform
setup in the Input QC form so the user can see the data being entered
into
the table. I set up a text box using this code (=[Forms]![Login
Form]![User
Log In]) im able to bring the user name from the log in form into the
input
qc form but i cant seem to get the user name to pass through to the
table
with each add record so i can query off user name. any help or ideas
 
J

jmo

Hi any thoughts on why i get blank records added when i scroll the mouse
wheel down on my Input QC1 form, this also happens when i close the form. It
just adds a blank record into my table
--
Jeremy Morton


jmo said:
worked...thanks
--
Jeremy Morton


Douglas J. Steele said:
There should be no need to put code into the control source of the field.

If you want to display the user name, you could put code in the form's
Current event to initialize the field's value, rather than setting its
control source:

Private Sub Form_Current()

If Me.NewRecord Then
Me!UserName = [Forms]![Login Form]![User Log In]
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jmo said:
Hi Douglas, so is doing this going to keep me from putting code into the
control source, then i will be able to use my table field User Name. i
still
trying to get your code to work for me and wanted to make sure i didnt
need
to do anything to the control source.
--
Jeremy Morton


:

Put code in the form's BeforeUpdate event to populate the field in the
form's recordset. Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me!UserName = [Forms]![Login Form]![User Log In]

End Sub

It's not even necessary for the UserName field to be visible on the form.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


im using access 2003, i have a login form where users login with a user
name
and password...they log into a Input QC form, from here they enter data
then
add record and the data is moved to the Input QC table. I have a
subform
setup in the Input QC form so the user can see the data being entered
into
the table. I set up a text box using this code (=[Forms]![Login
Form]![User
Log In]) im able to bring the user name from the log in form into the
input
qc form but i cant seem to get the user name to pass through to the
table
with each add record so i can query off user name. any help or ideas
 

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

Similar Threads


Top