replicate the id number from the previous record into the new reco

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

in Access 2003, I have a continuous form that I need for the field called
TransID (non-unique integer) to automatically replicate to any new fields
created in that table.

How do I do that?
 
BLTibbs said:
in Access 2003, I have a continuous form that I need for the field called
TransID (non-unique integer) to automatically replicate to any new fields
created in that table.


You can use the text box's AfterUpdate event to set its own
DefaultValue property:

Me.textbox.DefaultValue = Me.textbox.Value

That's for a numeric field. If the field is a text type
field, then use:

Me.textbox.DefaultValue = """" & Me.textbox.Value & """"

This way, once the value is set, it continues to be used
until the next time a different value is entered.

This will not remember a value when the form is closed. If
that's important or if you want to set the DefaultValue to
some other particular value when the form is opened, then
please explain what you want to do.
 
Actually, my wording was poor. What you gave me worked but not for my problem.

I am opening a continuous form that is linked to a query that is only
showing records with a certain [TransID] value (and it is a long integer
number). There could be 1 record or there could be 10 with that value (each
time this form is opened it could be a different transID list).

What I need to have happen is when a user creates a new record in that list
of specific transID's, the new record has to automatically take the transID
value of all of the rest of the records in that form at that time.
 
As long as there is at least one record in the form's
recordset, you can still use the same approach. Just do it
in the form's Load event instead of the text box's
AfterUpdate event.
--
Marsh
MVP [MS Access]


Actually, my wording was poor. What you gave me worked but not for my problem.

I am opening a continuous form that is linked to a query that is only
showing records with a certain [TransID] value (and it is a long integer
number). There could be 1 record or there could be 10 with that value (each
time this form is opened it could be a different transID list).

What I need to have happen is when a user creates a new record in that list
of specific transID's, the new record has to automatically take the transID
value of all of the rest of the records in that form at that time.


Marshall Barton said:
You can use the text box's AfterUpdate event to set its own
DefaultValue property:

Me.textbox.DefaultValue = Me.textbox.Value

That's for a numeric field. If the field is a text type
field, then use:

Me.textbox.DefaultValue = """" & Me.textbox.Value & """"

This way, once the value is set, it continues to be used
until the next time a different value is entered.

This will not remember a value when the form is closed. If
that's important or if you want to set the DefaultValue to
some other particular value when the form is opened, then
please explain what you want to do.
 

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

Back
Top