×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Unbound Controls set in Code vs Bound Data

Unbound Controls set in Code vs Bound Data

Unbound Controls set in Code vs Bound Data

(OP)
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 

RE: Unbound Controls set in Code vs Bound Data

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

RE: Unbound Controls set in Code vs Bound Data

(OP)
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!

RE: Unbound Controls set in Code vs Bound Data

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close