carrying over the last data entered in a form - help pls.

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I have a data entry form with 8 feilds. I want to set it
up in a way to carry the last data over when the add new
record command button is pressed since only one or two
feilds need to be changed and many of the last data
entered is still usable in new record entry. I have seen
a function in the Access Web page but there was no
explaination on how to use it or may be I couldn't
understand it.

here is the function:

******** Code Start **********
const cQuote="""" 'Thats two quotes
me!Control.DefaultValue = cQuote & me!Control.Value &
cQuote
'******** Code End **********

how can I used this function?
do I nned to use this for each and every feilds on my
form?

Thank you inadvance for your help.


A second question:

Can one build a customized tab order?

Regards,

Mike
 
You put the code (similar to what you found on the ACCESS Web) on the
AfterUpdate event of the control that is to "retain" the last-entered value
as the default value for the next new record:

Private Sub ControlName_AfterUpdate()
Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"
End Sub

With regard to a customized tab order, if you mean, can you change the order
of the controls that occurs when you tab from one control to another, open
the form in design view, click on View | Tab Order and there you can change
the order of the tabbing process.

If you mean can you change the order of the tab pages on a tab control, yes,
click on the tab control, and then click on View | Tab Order and set the
order there.
 
Hi Ken,

I put this code in the AfterUpdate of the feild on the
form, for example Combo46, but it doesn't carry over the
last record entered.

Private Sub Combo46_AfterUpdate()

Me.Combo46.DefaultValue = """" & Me.Combo46.Value
& """"
End Sub

Is there some thing wrong that I have done?


Regards,

Mike
 
Ken,

As you see 4 out of 6 feilds on my form are combo boxes
and it seems that this method isn't going to work unless
I'm doin dsomething wrong. please advise.

Regards,

Mike
 
Ken,

As you see 4 out of 6 feilds on my form are combo boxes
and it seems that this method isn't going to work unless
I'm doin dsomething wrong. please advise.

Regards,

Mike
 
When you say it isn't carrying over the value, what is happening (or not
happening)? What is the structure of the combo box (Row Source SQL, bound
column, column widths, etc.)? Is the combo box bound to a field in the
form's recordsource?
 
The combo boxes are based on a query which is in turn
based on a table. For example:


I have tblEmployee with one feild in it that has the name
od three employees, then I made a query based on that
table and a combo box based on that query to choose a
name inthe combo's drop down. also, a combo with feilds;
payment type, i.e. cash, check, ect. and one is choosen
on entering a record, another one has only two values
book A and Book B, where one is choosed when entering
records. all of these combo boxes are made in a same
fashon as explained above. I added the code to the
AfterUpdate properties of each of these conbo boxes but
on adding new record, it doesn't carry over the last
record entered.

Hope this help explain the scenario.

Regards,

Mike
 
By any chance do the booknames have " characters in them?

If you'd like, zip up the database and email it to me (remove this is not
real from my email address). I'll take a look at it Monday night when I get
home from work.
 
I keep a set of variables that are global to the forms class and can be
associated with the individual fields values that I want to keep track
of. I then set the variables in the forms afterupdate (this is after
the last record is saved but before the new record is started). Then I
set each fields default property to a class function that returns the
value of the variable I want for that field.

This way the new record is not "dirty" and won't be saved unless you
make an entry to a field in the underlying table for the form.
 
I keep a set of variables that are global to the forms class and can b
associated with the individual fields values that I want to keep trac
of. I then set the variables in the forms afterupdate (this is afte
the last record is saved but before the new record is started). Then
set each fields default property to a class function that returns th
value of the variable I want for that field.

This way the new record is not "dirty" and won't be saved unless yo
make an entry to a field in the underlying table for the form
 
One thing to watch out for with global variables...they are reset to default
values if an unhandled error occurs during the running of the code. I
usually use hidden/invisible textboxes on forms to "store" global
information so that the value is not lost.
 
Back
Top