A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

changing size of textbox to match form



 
 
Thread Tools Display Modes
  #11  
Old November 11th, 2007, 05:35 PM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
lyle
external usenet poster
 
Posts: 23
Default changing size of textbox to match form

On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.


"I couldn't make that work." is always kinder and almost always more
correct.

Here's some code.It works!

Does it work for what you want to do?
I can't find your code in this thread (is it there?) so I have no
idea.

Can you make it work?
I don't care.

May it help someone else?
I hope.

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As Rectangle) As Long

Private Type Rectangle
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Function FormLeft&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.Left
End Function

Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.Top
End Function




  #12  
Old November 12th, 2007, 02:31 AM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Phil Reynolds
external usenet poster
 
Posts: 54
Default changing size of textbox to match form


"lyle" wrote in message
ups.com...
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.


"I couldn't make that work." is always kinder and almost always more
correct.


True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.


  #13  
Old November 12th, 2007, 05:31 AM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Arch
external usenet poster
 
Posts: 4
Default changing size of textbox to match form

On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds"
wrote:


"lyle" wrote in message
oups.com...
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.


"I couldn't make that work." is always kinder and almost always more
correct.


True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.


They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.
  #14  
Old November 12th, 2007, 05:56 AM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
lyle
external usenet poster
 
Posts: 23
Default changing size of textbox to match form

On Nov 11, 12:35 pm, lyle wrote:
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.


"I couldn't make that work." is always kinder and almost always more
correct.

Here's some code.It works!

Does it work for what you want to do?
I can't find your code in this thread (is it there?) so I have no
idea.

Can you make it work?
I don't care.

May it help someone else?
I hope.

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As Rectangle) As Long

Private Type Rectangle
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Function FormLeft&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.Left
End Function

Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.Top
End Function


Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormTop = FormRectangle.Top
End Function

Thanks, Arch.

  #15  
Old November 12th, 2007, 07:41 AM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Phil Reynolds
external usenet poster
 
Posts: 54
Default changing size of textbox to match form

OK, you and Lyle are coming late to the game here, so I can see you're not
following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution worked
fine. No problem.

About a week later I replied to Rick again and asked how can I restore the
position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function to
restore that position. That was fine; but it didn't address how to store the
position parameters in the first place. So I replied to Bruce and asked how
I would get the Top and Left values for the window to store for later
reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not WindowLeft
or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:

They certainly do work, except for the small error in the second
function.


Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error," it
was still 100% of what was being asked.

It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.


Correct. And so Lyle's solution works, and the original didn't. What's the
issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative. It was just a simple statement of fact. I asked how to get
the Left and Top values for a window. He said, "Use the WindowLeft and
WindowTop." But those properties don't exist in Access 2000, so I said,
"That doesn't work." What's the issue here?


"Arch" wrote in message
...
On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds"
wrote:


"lyle" wrote in message
roups.com...
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.


True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.


They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.



  #16  
Old November 12th, 2007, 12:20 PM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default changing size of textbox to match form

When I post questions I sometimes forget to provide version information, and
when I answer questions I tend to assume the person who asked has the same
version as I do. I think this thread demonstrates the importance of
providing version information. Had you mentioned Access 2000 I might have
remembered to provide the caveat that my reply is based on Access 2003, and
that I can't be sure it is in other versions.
In any case, I took your reply to mean just what you explained: that the
properties are not part of Access 2000. Glad to hear you found something
that works.

"Phil Reynolds" wrote in message
news
OK, you and Lyle are coming late to the game here, so I can see you're not
following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution worked
fine. No problem.

About a week later I replied to Rick again and asked how can I restore the
position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function
to restore that position. That was fine; but it didn't address how to
store the position parameters in the first place. So I replied to Bruce
and asked how I would get the Top and Left values for the window to store
for later reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not
WindowLeft or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:

They certainly do work, except for the small error in the second
function.


Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error,"
it was still 100% of what was being asked.

It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.


Correct. And so Lyle's solution works, and the original didn't. What's the
issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative. It was just a simple statement of fact. I asked how to get
the Left and Top values for a window. He said, "Use the WindowLeft and
WindowTop." But those properties don't exist in Access 2000, so I said,
"That doesn't work." What's the issue here?


"Arch" wrote in message
...
On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds"
wrote:


"lyle" wrote in message
groups.com...
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop
property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.


They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.





  #17  
Old November 12th, 2007, 03:15 PM posted to comp.databases.ms-access,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Phil Reynolds
external usenet poster
 
Posts: 54
Default changing size of textbox to match form

Right -- I take responsiblity for not providing that version information.
And, as I noted, I don't really know what the issue is here, except that I
said, "It doesn't work," instead of, "I couldn't get it to work." But I
appreciate your taking the time to write either way! :-)


"BruceM" wrote in message
...
When I post questions I sometimes forget to provide version information,
and when I answer questions I tend to assume the person who asked has the
same version as I do. I think this thread demonstrates the importance of
providing version information. Had you mentioned Access 2000 I might have
remembered to provide the caveat that my reply is based on Access 2003,
and that I can't be sure it is in other versions.
In any case, I took your reply to mean just what you explained: that the
properties are not part of Access 2000. Glad to hear you found something
that works.

"Phil Reynolds" wrote in message
news
OK, you and Lyle are coming late to the game here, so I can see you're
not following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution
worked fine. No problem.

About a week later I replied to Rick again and asked how can I restore
the position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function
to restore that position. That was fine; but it didn't address how to
store the position parameters in the first place. So I replied to Bruce
and asked how I would get the Top and Left values for the window to store
for later reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not
WindowLeft or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:

They certainly do work, except for the small error in the second
function.


Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error,"
it was still 100% of what was being asked.

It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.


Correct. And so Lyle's solution works, and the original didn't. What's
the issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative. It was just a simple statement of fact. I asked how to
get the Left and Top values for a window. He said, "Use the WindowLeft
and WindowTop." But those properties don't exist in Access 2000, so I
said, "That doesn't work." What's the issue here?


"Arch" wrote in message
...
On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds"
wrote:


"lyle" wrote in message
egroups.com...
On Nov 11, 11:14 am, "Phil Reynolds" wrote:

Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop
property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.


They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.