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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound Controls set in Code vs Bound Data

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,207
US
This may be a bit of an oversimplification but assuming there are multiple controls or paragraphs to setup is it more efficient to use calculations or Literals in code...


Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   Me!TheControl = "Some Text " & Me!PipeIn1 & "Some More Text"
End Sub

Alternately the below control source may be used.


Code:
=Replace(TextField, "<PipeIn1>", PipeIn1)

The real issue arises in that there are permutations of "Some Text" or TextField that have to be accounted for.

I have been told that the former methodology is faster. I am not sure I am convinced but it is no trivial matter to test so I was hoping for a few good opinions.

These report nuances is just something I have not had to play with before.


Then I was not sure about FormatCount, would it be appropriate to only set values on the first pass which if I understood what I read correctly is 0?

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   If FormatCount = 0 Then 
      Me!TheControl = "Some Text " & Me!PipeIn1 & "Some More Text"
   End If
End Sub
 
I have a tendency to put data in tables. I would use the Replace() to perform you merge functionality.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thanks Duane.

Any thoughts on the FormatCount to only run once instead of multiple? I see that you are in most cases favoring the bound control approach but I have no experience with formatcount and was hoping for nuance insight. Thanks again!
 
I wouldn't worry about the format count in this case. I believe it is mostly used in cases where values are added or counted.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top