Value Won't Transfer from one form to another in 2007

D

DDBeards

When a customer finishes entering data, a check list form comes up to make
sure all of the required data has been entered. In the footer of the first
form are two calculated text boxes shown here

TMS_NumDates=Count([du_ID]) ' Id Number calculated on SFrm_Date_Used_E
TMS_Acutal=Count([du_Adate]) ' Actual date field calculated on
Frm_Date_Used_E

When the second form loads, vba code checks all the different requirments.
Here is the code for the problem:

Dim tDone, tTot As Integer

tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_Actual
tTot = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_NumDates

If tDone = tTot Then .........

When I debug the code both of the fields (actual and numdates) show 2,
however, the tdone and ttot show 0 and empty. Can anyone explain what is
happening here?

Thanks
 
J

Jeanette Cunningham

To get a value from a subform from a different form, the syntax is

Forms!NameOfForm!SubformControlName.Form!NameOfControl

so if your subform control is called SFrm_Date_Used_E

Try it like this
tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E.Form.TMS_Actual


Note: to avoid needing to remember where to use a bang! versus a dot.
I usually write it like this
tDone = Forms("frmPTS_Edit")SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

Correction, left out a dot after
Forms("frmPTS_Edit")

It should read
tDone = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jeanette Cunningham said:
To get a value from a subform from a different form, the syntax is

Forms!NameOfForm!SubformControlName.Form!NameOfControl

so if your subform control is called SFrm_Date_Used_E

Try it like this
tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E.Form.TMS_Actual


Note: to avoid needing to remember where to use a bang! versus a dot.
I usually write it like this
tDone = Forms("frmPTS_Edit")SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


DDBeards said:
When a customer finishes entering data, a check list form comes up to
make
sure all of the required data has been entered. In the footer of the
first
form are two calculated text boxes shown here

TMS_NumDates=Count([du_ID]) ' Id Number calculated on
SFrm_Date_Used_E
TMS_Acutal=Count([du_Adate]) ' Actual date field calculated on
Frm_Date_Used_E

When the second form loads, vba code checks all the different
requirments.
Here is the code for the problem:

Dim tDone, tTot As Integer

tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_Actual
tTot = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_NumDates

If tDone = tTot Then .........

When I debug the code both of the fields (actual and numdates) show 2,
however, the tdone and ttot show 0 and empty. Can anyone explain what is
happening here?

Thanks
 
D

DDBeards

Thank you for your responce, here is what I changed:
' tDone = Forms!frmPTS_Edit.SFrm_Date_Used_E!TMS_Actual
' tTot = Forms!frmPTS_Edit.SFrm_Date_Used_E!TMS_NumDates
tDone = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_Actual
tTot = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_NumDates

with the same results, however, here is one thing. If I turn the stop point
Correction, left out a dot after
Forms("frmPTS_Edit")

It should read
tDone = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jeanette Cunningham said:
To get a value from a subform from a different form, the syntax is

Forms!NameOfForm!SubformControlName.Form!NameOfControl

so if your subform control is called SFrm_Date_Used_E

Try it like this
tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E.Form.TMS_Actual


Note: to avoid needing to remember where to use a bang! versus a dot.
I usually write it like this
tDone = Forms("frmPTS_Edit")SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


DDBeards said:
When a customer finishes entering data, a check list form comes up to
make
sure all of the required data has been entered. In the footer of the
first
form are two calculated text boxes shown here

TMS_NumDates=Count([du_ID]) ' Id Number calculated on
SFrm_Date_Used_E
TMS_Acutal=Count([du_Adate]) ' Actual date field calculated on
Frm_Date_Used_E

When the second form loads, vba code checks all the different
requirments.
Here is the code for the problem:

Dim tDone, tTot As Integer

tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_Actual
tTot = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_NumDates

If tDone = tTot Then .........

When I debug the code both of the fields (actual and numdates) show 2,
however, the tdone and ttot show 0 and empty. Can anyone explain what is
happening here?

Thanks


.
 
J

Jeanette Cunningham

I haven't created a form and tried to get the values of calculated textboxes
in the open event of the opening form.
I suggest that you pass the values of tDone and tTot in OpenArgs to the
second form instead of your current approach that is not working.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


DDBeards said:
Thank you for your responce, here is what I changed:
' tDone = Forms!frmPTS_Edit.SFrm_Date_Used_E!TMS_Actual
' tTot = Forms!frmPTS_Edit.SFrm_Date_Used_E!TMS_NumDates
tDone = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_Actual
tTot = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_NumDates

with the same results, however, here is one thing. If I turn the stop
point
on and step through the code, the results show. However, when I run the
code
with no stop points the same 0 and blank appears?

Jeanette Cunningham said:
Correction, left out a dot after
Forms("frmPTS_Edit")

It should read
tDone = Forms("frmPTS_Edit").SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jeanette Cunningham said:
To get a value from a subform from a different form, the syntax is

Forms!NameOfForm!SubformControlName.Form!NameOfControl

so if your subform control is called SFrm_Date_Used_E

Try it like this
tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E.Form.TMS_Actual


Note: to avoid needing to remember where to use a bang! versus a dot.
I usually write it like this
tDone = Forms("frmPTS_Edit")SFrm_Date_Used_E.Form.TMS_Actual


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


When a customer finishes entering data, a check list form comes up to
make
sure all of the required data has been entered. In the footer of the
first
form are two calculated text boxes shown here

TMS_NumDates=Count([du_ID]) ' Id Number calculated on
SFrm_Date_Used_E
TMS_Acutal=Count([du_Adate]) ' Actual date field calculated on
Frm_Date_Used_E

When the second form loads, vba code checks all the different
requirments.
Here is the code for the problem:

Dim tDone, tTot As Integer

tDone = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_Actual
tTot = Forms!frmPTS_Edit!SFrm_Date_Used_E!TMS_NumDates

If tDone = tTot Then .........

When I debug the code both of the fields (actual and numdates) show 2,
however, the tdone and ttot show 0 and empty. Can anyone explain what
is
happening here?

Thanks


.
 

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