• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 954
  • Last Modified:

Alternative to TextWidth

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
simonfinn
Asked:
simonfinn
  • 4
  • 3
1 Solution
 
peterKCommented:
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
 
simonfinnAuthor Commented:
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
 
simonfinnAuthor Commented:
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.

 
peterKCommented:
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
 
simonfinnAuthor Commented:
Hi Peter

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

Would i have to use the API here?

Si
0
 
peterKCommented:
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
 
simonfinnAuthor Commented:
Sorry about the delay,

Im gonna give the API a go

Thanks for the help

Si
0
 
mydatabaseguyCommented:
Did you ever get a textwidth alternative? If so please post the code as I need it badly.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now