Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting control source for unbound text box 1

Status
Not open for further replies.

jadams0173

Technical User
Feb 18, 2005
1,210
Can I set the control Source for an unbound text box in the footer of my report thru code. When I do it this way I get prompted for a paramater and the label of the input for the parameter has the value of my DSum.

Code:
Private Sub Report_Open(Cancel As Integer)
Dim sql     As String
Dim TempReport      As String
Dim RelDate         As Date
Dim tt As Integer

DoCmd.SetWarnings False

RelDate = Format(Now(), "mm/dd/yyyy")


TempReport = "Report_" & Environ("username")
'Debug.Print DATE

sql = "SELECT data" _
    & "INTO " & TempReport 

DoCmd.RunSQL sql

[red]Me!txtFeederTotal.ControlSource = DSum("[FEEDERTOTAL]", TempReport)[/red]

Reports!rpt_wh_feederload_requirements.RecordSource = TempReport
DoCmd.SetWarnings True
End Sub

I've tried it before and after setting the recordsource for the report.
 
Try without specifying the Control Source:
Code:
   Me!txtFeederTotal = DSum("[FEEDERTOTAL]", TempReport)
or
Code:
Me!txtFeederTotal.ControlSource = "=DSum('[FEEDERTOTAL]','" &  TempReport & "')"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks Duane.

Code:
Me!txtFeederTotal.ControlSource = "=DSum('[FEEDERTOTAL]','" &  TempReport & "')"

Worked. I had tried that but I think I left the = out. Thanks again!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top