Records on a form

  • Thread starter Thread starter Darrin
  • Start date Start date
D

Darrin

Hi,

I have a pull down box on a form that when the user makes
a selection the date field and time field is populated
with the current date/time. As in:

Private Sub BTRecdBy_AfterUpdate()

Me.BTRecdDate = Date
Me.BTRecdTime = Time

End Sub

But I would like to have this pass through all records on
the form and I am having trouble with working with
recordsets. The form's name is: frmReceivedData. The
form's control source is: qryReceivedData

So, how would the code be written to have it so when the
user makes a selection from "ReceivedBy" pull-down box...
the date field and time field would be populated for all
the records shown on the form?

Thanks for the help!
 
Darrin said:
Hi,

I have a pull down box on a form that when the user makes
a selection the date field and time field is populated
with the current date/time. As in:

Private Sub BTRecdBy_AfterUpdate()

Me.BTRecdDate = Date
Me.BTRecdTime = Time

End Sub

But I would like to have this pass through all records on
the form and I am having trouble with working with
recordsets. The form's name is: frmReceivedData. The
form's control source is: qryReceivedData

So, how would the code be written to have it so when the
user makes a selection from "ReceivedBy" pull-down box...
the date field and time field would be populated for all
the records shown on the form?

Thanks for the help!

You could do that either by looping through the form's recordsetclone or
(better) by running an update query on the form's recordsource ... but
why? The need to duplicate this information suggests that the received
date/time should be stored at a higher level, on the "one" side of a
one-to-many relationship. For example, if you had a table of Orders and
a related table of OrderItems listing the items in each order, it would
make sense to store the date the order was received only once, in the
Orders table, rather than multiple times in the OrderItems table. You
would normally represent this on screen with a main form based on the
parent table ("Orders", in this example), containing a subform based on
the "child" table ("OrderItems").

Now, I can already see a possible problem with this, and that is if the
subordinate items might not all be received at the same time. In that
case, you *would* need to store the received date/time separately for
each item, but you might want an easy way to initially mark them all as
received at once. Is this the sort of situation you're faced with? If
so, then it can be done, as I said above, in a couple of ways, but I'd
need to know more about your actual tables and forms to say more. If
you need to go this route, please post back with the details of the
tables and forms/subforms involved.
 
Back
Top