Autofill subform to mainform

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

Guest

I am sorry I have asked this before. I want to copy the date from a subform
into the main form. maybe it cannot be done or maybe I did not explain myself
very well. but I keep looking at it and cannot see how to sort it out.

The underlying tables and fields are:

Events: (Form=Events)

StartDate
Endate

TblEventsLocation (Form=EventsSubform1)

Date (datefield)
Day (integer field)
NumberofDays (integer field)

I would like to copy the date in eventssubform1 to the Startdate on the main
form only when day=1

and I would like to copy date in the eventssubform1 to end date when day and
numberofdaysfield are equal e.g day=3 numberofdays=3

I know that I should not be storing the same information twice, but without
doing a complete rebiuld it cannot be done.

thanks in advance for any help

Phil
 
Phil,

Not sure *when* you want this to happen. But assuming an event on the
subform (e.g. After Update, or maybe Click of a command button), then
something like this?....

If Me.Day = 1 Then
Me.Parent!StartDate = Me.Date
End If
If Me.Day = Me.NumberOfDays Then
Me.Parent!Endate = Me.Date
End If

Please note that 'day' and 'date' are both Reserved Words (i.e. have a
special meaning) in Access, and as such should not be used as the names
of fields or controls. I would encourage you to change these.
 
Steve

thanks for this it works great. I knew when I posted I would get a comment
about day and date fields, i have added it to my list of of things to change

thanks again for your help

Phil
 

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