Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2006, 12:57 PM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Assigning a value to a report text box using VB

Ok I think this problem is just a matter of syntax.
I'm trying to fill in a text box with fields from a recordset.
If I were just typing what I wanted into the
Data/control source field it would look like this:

= "Transacciones correspondiendo al recipiente: " & rst!FirstName.value & " " & rst!LastName.Value

so I put it into the format section of report header like this

Me.txtTitle = = "Transacciones correspondiendo al recipiente: " & rst!FirstName.value & " " & rst!LastName.Value

It's obvious that the quotes are messing things up, but I've tried a number of ideas and I can't figure out how the quotes should be. Also both first and last name are strings so I think I need the other quotes to typecast them.

Thanks for your help


Enoch
__________________
Enoch
 
Old January 19th, 2006, 01:34 PM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok well, I feel kind of silly, but I realized I should be using
the controlsource property rather than the value property. I think I can figure out how the quotes work
sorry to waste time.


Enoch
 
Old January 19th, 2006, 01:57 PM
Authorized User
 
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just in case anyone is interested, here's a working answer to my question.

First off, it turns out you can't assign the controlsource property in a format event. So I placed it in the open event

    Me!txtTitle.ControlSource = "= 'Donaciones al Beneficiario: " & _
       rst!FirstName & " " & rst!LastName & "'"

You don't need to typecast the rst fields because it's already within the quotes. I think I could actually change this to a label.


Enoch





Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating VBA calculated Text Box throught Report wintermute Access VBA 2 March 28th, 2008 12:00 PM
Large report in text box takabyte Beginning VB 6 3 August 6th, 2007 07:32 PM
#Error displayed in text box on report RayL Access VBA 3 March 16th, 2007 07:12 AM
How to change the width of text box in a Report kishorelakkimsetty Reporting Services 3 May 13th, 2006 01:50 PM
VB TEXT BOX VALUE akash VB How-To 2 April 29th, 2005 10:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.