Re. Current User() Lynn Trapp or Joan

G

Guest

Reposting haven't resolved yet. See previous posting

Lynn or Joan or anyone else,

below is the function it is calling up on the OnCurrent event . It
autofills fields from the previous record. Not sure how to exclude the
username field. Any ideas??

Thanks for helping,
Barb

Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F
'Fill The field if All fields are to be filled Or if the
'....ControlSource field can be found in the Fill Fields list.

If FillAllFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
C = RS(C.ControlSource)
End If
Next

F.Painting = True

End Function


:

Click to show or hide original message or reply text.

Babs,
You clearly have something in the OnCurrent event that is causing a new
record to be saved to the database. That code is firing when you navigate to
a NEW record. You need to fix that and you should be ok.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



babs said:
REposting - since haven't heard back in 4 days. Lynn are you still
there??
any ideas??

Babs,
I asked in the other thread if you also have the same code in the Current
Event. The BeforeUpdate event of the form will not fire unless there is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html




Click to show or hide original message or reply text.

When I first come back into the form and Navigate forward (1 to 2) under
a
different user I can see the username is set to who put the record in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user to
change
if just navigate with buttons through records and not changing data .
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com



Was this post helpful to you?
Reply Top





babs 5/4/2006 10:59 AM PST



Below is the only code I have on the Current event of the Form- think it
may
be this autofill not sure how to get around it.



Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub

thanks for helping
:

Click to show or hide original message or reply text.

Babs,
I asked in the other thread if you also have the same code in the Current
Event. The BeforeUpdate event of the form will not fire unless there is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html





When I first come back into the form and Navigate forward (1 to 2)
under a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like
it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user to
change
if just navigate with buttons through records and not changing data
.
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com



Was this post helpful to you?
Reply Top





Keith Wilby 5/5/2006 4:30 AM PST



babs said:
Below is the only code I have on the Current event of the Form- think it
may
be this autofill not sure how to get around it.


Call AutoFillNewRecord([Forms]![QuoteEntryForm])

This line is calling another procedure. Put your cursor somewhere in
"AutoFillNewRecord", hold <SHIFT> and press <F2> to display the code -
what
does it do?

Keith.
www.keithwilby.com





Was this post helpful to you?
Reply Top





babs 5/5/2006 7:03 AM PST



It is calling on the Function autofillnewrecord see below:
How can I not make it autofill just the user I guess?????


Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F



Was this post helpful to you?
Reply Top





babs 5/16/2006 8:32 AM PST



Thought I would include the Main and Only code(see below) on the OnCurrent
event of the form

I looked up the unbound field that the module autofillnewrecord calls and
username is not one of the fields that should be autofilled.


Not seeing what from below can be causing the username to be put is as I
JUST navigate records????


Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub
 
G

Guest

I took out the line BELOW from the onCurrent event of the form and the
username() works fine now. However, I am trying to capture the record number
ON the form and I used the below code but it messes up the username() as
navigate through records( makes the all the current user) not sure how to
modify below code so username still able to work.



Me![Recordnumber] = Me.CurrentRecord

thanks,
Barb


babs said:
Reposting haven't resolved yet. See previous posting

Lynn or Joan or anyone else,

below is the function it is calling up on the OnCurrent event . It
autofills fields from the previous record. Not sure how to exclude the
username field. Any ideas??

Thanks for helping,
Barb

Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F
'Fill The field if All fields are to be filled Or if the
'....ControlSource field can be found in the Fill Fields list.

If FillAllFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
C = RS(C.ControlSource)
End If
Next

F.Painting = True

End Function


:

Click to show or hide original message or reply text.

Babs,
You clearly have something in the OnCurrent event that is causing a new
record to be saved to the database. That code is firing when you navigate to
a NEW record. You need to fix that and you should be ok.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



babs said:
REposting - since haven't heard back in 4 days. Lynn are you still
there??
any ideas??

Babs,
I asked in the other thread if you also have the same code in the Current
Event. The BeforeUpdate event of the form will not fire unless there is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html




Click to show or hide original message or reply text.




When I first come back into the form and Navigate forward (1 to 2) under
a
different user I can see the username is set to who put the record in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user to
change
if just navigate with buttons through records and not changing data .
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com






Was this post helpful to you?
Reply Top





babs 5/4/2006 10:59 AM PST



Below is the only code I have on the Current event of the Form- think it
may
be this autofill not sure how to get around it.



Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub

thanks for helping
:

Click to show or hide original message or reply text.


Babs,
I asked in the other thread if you also have the same code in the Current
Event. The BeforeUpdate event of the form will not fire unless there is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html





When I first come back into the form and Navigate forward (1 to 2)
under a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like
it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user to
change
if just navigate with buttons through records and not changing data
.
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com









Was this post helpful to you?
Reply Top





Keith Wilby 5/5/2006 4:30 AM PST



Below is the only code I have on the Current event of the Form- think it
may
be this autofill not sure how to get around it.
 
L

Lynn Trapp

Barb,
The problem you are having is because the Current event fires whenever you
navigate to a record -- next record, previous record, or NEW record. If you
have code in that even that creates a new record -- and filling fields based
on the previous record will do that -- then you will get a record added to
the table just by virtue of moving to a new record. If you want to avoid
that, then you MUST remove your code from the Current event.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



babs said:
Reposting haven't resolved yet. See previous posting

Lynn or Joan or anyone else,

below is the function it is calling up on the OnCurrent event . It
autofills fields from the previous record. Not sure how to exclude the
username field. Any ideas??

Thanks for helping,
Barb

Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F
'Fill The field if All fields are to be filled Or if the
'....ControlSource field can be found in the Fill Fields list.

If FillAllFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
C = RS(C.ControlSource)
End If
Next

F.Painting = True

End Function


:

Click to show or hide original message or reply text.

Babs,
You clearly have something in the OnCurrent event that is causing a new
record to be saved to the database. That code is firing when you navigate
to
a NEW record. You need to fix that and you should be ok.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



babs said:
REposting - since haven't heard back in 4 days. Lynn are you still
there??
any ideas??

Babs,
I asked in the other thread if you also have the same code in the
Current
Event. The BeforeUpdate event of the form will not fire unless there is
a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html




Click to show or hide original message or reply text.




When I first come back into the form and Navigate forward (1 to 2)
under
a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like
it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to
do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user
to
change
if just navigate with buttons through records and not changing data
.
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before
Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com






Was this post helpful to you?
Reply Top





babs 5/4/2006 10:59 AM PST



Below is the only code I have on the Current event of the Form- think
it
may
be this autofill not sure how to get around it.



Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub

thanks for helping
:

Click to show or hide original message or reply text.


Babs,
I asked in the other thread if you also have the same code in the
Current
Event. The BeforeUpdate event of the form will not fire unless there
is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html





When I first come back into the form and Navigate forward (1 to 2)
under a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you
said
about
newrecord- not sure exactly how to do that or if want to - would
like
it
to
catch the user if the data is modified even on an exisiting record
but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to
do.
Got
rid of the userauto in query - not sure what to attach it to or
the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user
to
change
if just navigate with buttons through records and not changing
data
.
if
data changed in record or record added want the new user
captured.


Include a text box bound to your "user" field on your form, name
the
text
box "txtUser". Set its locked property to "True". In the Before
Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it
to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com









Was this post helpful to you?
Reply Top





Keith Wilby 5/5/2006 4:30 AM PST



Below is the only code I have on the Current event of the Form- think
it
may
be this autofill not sure how to get around it.


Call AutoFillNewRecord([Forms]![QuoteEntryForm])

This line is calling another procedure. Put your cursor somewhere in
"AutoFillNewRecord", hold <SHIFT> and press <F2> to display the code -
what
does it do?

Keith.
www.keithwilby.com





Was this post helpful to you?
Reply Top





babs 5/5/2006 7:03 AM PST



It is calling on the Function autofillnewrecord see below:
How can I not make it autofill just the user I guess?????


Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F



Was this post helpful to you?
Reply Top





babs 5/16/2006 8:32 AM PST



Thought I would include the Main and Only code(see below) on the
OnCurrent
event of the form

I looked up the unbound field that the module autofillnewrecord calls and
username is not one of the fields that should be autofilled.


Not seeing what from below can be causing the username to be put is as I
JUST navigate records????


Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub
 
G

Guest

Lynn,

See posting above dated 5/16/06 I kept the fill record code ONCURRENT OF
FORM from previous record - only includes some fields - not username.-
Everything WORKS GREAT! HOWEVER HAD TO TAKE OUT:

Me![Recordnumber] = Me.CurrentRecord

for it to work. Is there Anyway I can capture the recordnumber and not mess
up the username while I navigate records.

thanks,
Barb

Lynn Trapp said:
Barb,
The problem you are having is because the Current event fires whenever you
navigate to a record -- next record, previous record, or NEW record. If you
have code in that even that creates a new record -- and filling fields based
on the previous record will do that -- then you will get a record added to
the table just by virtue of moving to a new record. If you want to avoid
that, then you MUST remove your code from the Current event.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



babs said:
Reposting haven't resolved yet. See previous posting

Lynn or Joan or anyone else,

below is the function it is calling up on the OnCurrent event . It
autofills fields from the previous record. Not sure how to exclude the
username field. Any ideas??

Thanks for helping,
Barb

Function AutoFillNewRecord(F As Form)

Dim RS As DAO.Recordset, C As Control
Dim FillFields As String, FillAllFields As Integer

'On Error Resume Next

'Exit if not on the new record.
If Not F.NewRecord Then Exit Function

'Goto the last record of the form recordset(to auofill form).
Set RS = F.RecordsetClone
RS.MoveLast

'Exit if you cannot move to the last record(no records).
If Err <> 0 Then Exit Function

'Get the list of fields to autofill.
FillFields = ";" & F![AutoFillNewRecordFields] & ";"

'If there is no criteria field, then set flag indicating ALL
'fields should be autofilled.
FillAllFields = Err <> 0

F.Painting = False

'Visit each field on the form.
For Each C In F
'Fill The field if All fields are to be filled Or if the
'....ControlSource field can be found in the Fill Fields list.

If FillAllFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
C = RS(C.ControlSource)
End If
Next

F.Painting = True

End Function


:

Click to show or hide original message or reply text.

Babs,
You clearly have something in the OnCurrent event that is causing a new
record to be saved to the database. That code is firing when you navigate
to
a NEW record. You need to fix that and you should be ok.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



REposting - since haven't heard back in 4 days. Lynn are you still
there??
any ideas??

Babs,
I asked in the other thread if you also have the same code in the
Current
Event. The BeforeUpdate event of the form will not fire unless there is
a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html




Click to show or hide original message or reply text.




When I first come back into the form and Navigate forward (1 to 2)
under
a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you said
about
newrecord- not sure exactly how to do that or if want to - would like
it
to
catch the user if the data is modified even on an exisiting record but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to
do.
Got
rid of the userauto in query - not sure what to attach it to or the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user
to
change
if just navigate with buttons through records and not changing data
.
if
data changed in record or record added want the new user captured.


Include a text box bound to your "user" field on your form, name the
text
box "txtUser". Set its locked property to "True". In the Before
Update
event of the form put

Me.txtUser=CurrentUser()

This will update every time the record is updated. If you want it to
stay
the same from when the record is created then you'd need to use the
NewRecord property (check it out in the help).

HTH - Keith.
www.keithwilby.com






Was this post helpful to you?
Reply Top





babs 5/4/2006 10:59 AM PST



Below is the only code I have on the Current event of the Form- think
it
may
be this autofill not sure how to get around it.



Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![QuoteEntryForm])
End Sub

thanks for helping
:

Click to show or hide original message or reply text.


Babs,
I asked in the other thread if you also have the same code in the
Current
Event. The BeforeUpdate event of the form will not fire unless there
is a
change. What you are describing sounds like something caused by the
Current
event firing.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html





When I first come back into the form and Navigate forward (1 to 2)
under a
different user I can see the username is set to who put the record
in.(or
who
looked at it last). Then when I navigate back it gets reset to the
present
user. I don't want the username to change if a new person is just
navigating
through the records??? Any ideas.

I also posted on Security sorry if this is a problem. I know you
said
about
newrecord- not sure exactly how to do that or if want to - would
like
it
to
catch the user if the data is modified even on an exisiting record
but
don't
want it to change if record is just navigated through.


thanks,
Barb


:

I have a field in the table called user but not sure what else to
do.
Got
rid of the userauto in query - not sure what to attach it to or
the
exact
code.

user=currentuser()

attached it to the before updat of the form - don't want the user
to
change
if just navigate with buttons through records and not changing
data
.
if
data changed in record or record added want the new user
captured.
 

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