Populate date to another

C

CJ

Hi Groupies

I am trying to populate a Date from one subform to another subform
on the same Parent but the field is not populating consistently so I am
trying to force it. I have tried a few things, a couple are below:

I tried this first:

Private Sub lngEmpID_BeforeUpdate(Cancel As Integer)

If IsNull(Me.Parent.txtDefaultDate) And IsNull(Me.dtmDate) Then
Me.dtmDate.Value = Date
ElseIf Not IsNull(Me.dtmDate) Then
Me.dtmDate = Me.dtmDate
Else
Me.dtmDate.Value = Me.Parent.txtDefaultDate
End If

Then I changed the If statement to:

Me.Parent.fsubEmployeeDayCosts.dtmDate.Value = Me.dtmDate.Value

Neither of them are working. Could somebody please
solve this issue for me.
 
T

tony

Hi Groupies

I am trying to populate a Date from one subform to another subform
on the same Parent but the field is not populating consistently so I am
trying to force it. I have tried a few things, a couple are below:

I tried this first:

Private Sub lngEmpID_BeforeUpdate(Cancel As Integer)

    If IsNull(Me.Parent.txtDefaultDate) And IsNull(Me.dtmDate) Then
        Me.dtmDate.Value = Date
    ElseIf Not IsNull(Me.dtmDate) Then
        Me.dtmDate = Me.dtmDate
    Else
        Me.dtmDate.Value = Me.Parent.txtDefaultDate
    End If

Then I changed the If statement to:

    Me.Parent.fsubEmployeeDayCosts.dtmDate.Value = Me.dtmDate.Value

Neither of them are working. Could somebody please
solve this issue for me.

I had a similar issue to this recently and found that you must
populate the field in the subform that contains the field you wish to
change.

So if your taking the date from subform1 and trying to put it into
subform2 you must pass this date over to subform2 and then populate
it.

I also found that it was best to perform a requery on subform2 so that
the data 'takes' if you get my meaning.

I'm sure one of the Access guru's will be able to explain ii better.
 
C

CJ

Hi Tony
Thanks for popping in.

I agree. I think I am just down to needing to requery on the correct event.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Hi Groupies

I am trying to populate a Date from one subform to another subform
on the same Parent but the field is not populating consistently so I am
trying to force it. I have tried a few things, a couple are below:

I tried this first:

Private Sub lngEmpID_BeforeUpdate(Cancel As Integer)

If IsNull(Me.Parent.txtDefaultDate) And IsNull(Me.dtmDate) Then
Me.dtmDate.Value = Date
ElseIf Not IsNull(Me.dtmDate) Then
Me.dtmDate = Me.dtmDate
Else
Me.dtmDate.Value = Me.Parent.txtDefaultDate
End If

Then I changed the If statement to:

Me.Parent.fsubEmployeeDayCosts.dtmDate.Value = Me.dtmDate.Value

Neither of them are working. Could somebody please
solve this issue for me.

I had a similar issue to this recently and found that you must
populate the field in the subform that contains the field you wish to
change.

So if your taking the date from subform1 and trying to put it into
subform2 you must pass this date over to subform2 and then populate
it.

I also found that it was best to perform a requery on subform2 so that
the data 'takes' if you get my meaning.

I'm sure one of the Access guru's will be able to explain ii better.
 

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