?
Solved

Alternative to TextWidth

Posted on 2003-03-07
8
Medium Priority
?
944 Views
Last Modified: 2012-05-04
Hi Guys

Im currently adjusting the width of a MS flexigrid on the fly to fit the data that is inputted through a SQL Query.

I am trying to use TextWidth to return the pixal width of data (when formatted on screen) but VBA doesnt support this as it is a Function of the Printer Object (which isnt supported by VBA)

Is there another way i can return this value

Thanks Si
0
Comment
Question by:simonfinn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
peterK earned 200 total points
ID: 8087471
Hi,
as far as I know you have to use the DeviceContext API function calls of the Windows system, which needs a lot of coding/declaring in access.
0
 

Author Comment

by:simonfinn
ID: 8087494
Hi PeterK

Im trying to keep the amount of code to a minimum at the moment, so if there is another quicker way it would be more ideal.

Thanks though, it may be the only way.

Si
0
 

Author Comment

by:simonfinn
ID: 8087551
Hi Peter

Actually after a bit more research, u are totally right it is the only way.

Could u give me a quick example?

Cheers Si
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:peterK
ID: 8087577
Hi Si,

which Access version you use, and do you output to a Form or a Report?
In accessXP is a PrinterObject known, but only with limited functionality. Otherwise print you string to a report, even if its only hidden, and use the TextWidth method of the report object.

Peter
0
 

Author Comment

by:simonfinn
ID: 8087596
Hi Peter

The output is on a form and im using Office 2000 Pro

Would i have to use the API here?

Si
0
 
LVL 1

Expert Comment

by:peterK
ID: 8087618
Hi Si,

I never did this stuff in Access. If I have to use API calls in a Access application, I preffer to code this stuff in C/C++. Coding the API Calls in VisualC, build a DLL modul with a simple interface, call the DLL from access with one function and some parameters.

For your problem I don't have such a modul. If your want I could provide you with the information which calls to the API to use for solving you problem

Just contact me at peterK@gebacom.de

Peter
0
 

Author Comment

by:simonfinn
ID: 8098797
Sorry about the delay,

Im gonna give the API a go

Thanks for the help

Si
0
 
LVL 4

Expert Comment

by:mydatabaseguy
ID: 14040586
Did you ever get a textwidth alternative? If so please post the code as I need it badly.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question