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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
enter text in text box without setting focus
Hey everyone ,
I have a fittings database to track fittings in a shelving unit. I am trying make a report to draw a chart of the location of all the fittings where some of the drawers can have up to 8 fitting. I am placing text boxes based on calculated positions base on quantitys of drawer slots and of locations. When I have placed the text boxes I want to put the name of each fitting in the text box. When I try to change the textbox it says I have to have focus but when I try to set focus it says property or method not supported. How can I change the text in each text box without setting focus to the control ?? Thanks ahead of time diagheight = 1400 diagwidth = 1225 ' twips drawersize = 150 Set db = CurrentDb() fittings = DLookup("ftgcnt", "qrycount") ' total count of fittings names ftgs = Val(fittings) Set rst = db.OpenRecordset("tblFtgs", dbOpenTable) rst.MoveFirst ' I have a report the has about 200 text boxes with visible = false For index = 2 To (fittings + 1) ' ' a b c d e '1 drawer slots a b c d e f g h 8" wide '2 10" high '3 '4 '5 '6 '7 '8 ' posstr = rst![fldLocation] col = Val(Asc(Left(posstr, 1))) - 64 row = Val(Mid(posstr, 2, 1)) pos = Val(Asc(Right(posstr, 1))) - 64 If col = 8 Then col = 7 Debug.Print "row = " & Str(row) & "col = " & Str(col) & "pos = " & Str (pos) xpos = 200 + (diagwidth * (col - 1)) ypos = 10 + (diagheight * (row - 1)) + (pos * drawersize) ' Debug.Print "xpos " & xpos & " ypos " & ypos Report_rptTest.Controls(index).Left = xpos Report_rptTest.Controls(index).Top = ypos Report_rptTest.Controls(index).width = 500 Report_rptTest.Controls(index).height = 125 '.Report_rptTest.Controls(index).SetFocus = True '.Report_rptTest.Controls(index) = posstr Report_rptTest.Controls(index).Visible = True Report_rptTest.Controls(index).BackColor = 25000 rst.MoveNext ' Debug.Print index & " " & xpos & " " & ypos Next index db.Close -- Danny C. Sperry Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200707/1 |
#2
|
|||
|
|||
enter text in text box without setting focus
Dsperry101 via AccessMonster.com wrote:
Hey everyone , I have a fittings database to track fittings in a shelving unit. I am trying make a report to draw a chart of the location of all the fittings where some of the drawers can have up to 8 fitting. I am placing text boxes based on calculated positions base on quantitys of drawer slots and of locations. When I have placed the text boxes I want to put the name of each fitting in the text box. When I try to change the textbox it says I have to have focus but when I try to set focus it says property or method not supported. How can I change the text in each text box without setting focus to the control ?? Thanks ahead of time diagheight = 1400 diagwidth = 1225 ' twips drawersize = 150 Set db = CurrentDb() fittings = DLookup("ftgcnt", "qrycount") ' total count of fittings names ftgs = Val(fittings) Set rst = db.OpenRecordset("tblFtgs", dbOpenTable) rst.MoveFirst ' I have a report the has about 200 text boxes with visible = false For index = 2 To (fittings + 1) ' ' a b c d e '1 drawer slots a b c d e f g h 8" wide '2 10" high '3 '4 '5 '6 '7 '8 ' posstr = rst![fldLocation] col = Val(Asc(Left(posstr, 1))) - 64 row = Val(Mid(posstr, 2, 1)) pos = Val(Asc(Right(posstr, 1))) - 64 If col = 8 Then col = 7 Debug.Print "row = " & Str(row) & "col = " & Str(col) & "pos = " & Str (pos) xpos = 200 + (diagwidth * (col - 1)) ypos = 10 + (diagheight * (row - 1)) + (pos * drawersize) ' Debug.Print "xpos " & xpos & " ypos " & ypos Report_rptTest.Controls(index).Left = xpos Report_rptTest.Controls(index).Top = ypos Report_rptTest.Controls(index).width = 500 Report_rptTest.Controls(index).height = 125 '.Report_rptTest.Controls(index).SetFocus = True '.Report_rptTest.Controls(index) = posstr Report_rptTest.Controls(index).Visible = True Report_rptTest.Controls(index).BackColor = 25000 rst.MoveNext ' Debug.Print index & " " & xpos & " " & ypos Next index db.Close Did you see my response to your question in another thread in a another forum? Please don't multipost. If you must post to multiple forums, crosspost instead (by putting both forums in the NewsGroups box). -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
enter text in text box without setting focus
Marshall ,
I did post this question previously but when I seached for it I couldn't find it. I did a search on my user name and it doesn't show up. Where did you find the other posting of the question ? Marshall Barton wrote: Hey everyone , I have a fittings database to track fittings in a shelving unit. I am [quoted text clipped - 54 lines] Next index db.Close Did you see my response to your question in another thread in a another forum? Please don't multipost. If you must post to multiple forums, crosspost instead (by putting both forums in the NewsGroups box). -- Danny C. Sperry Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200707/1 |
#4
|
|||
|
|||
enter text in text box without setting focus
Dsperry101 via AccessMonster.com wrote:
I did post this question previously but when I seached for it I couldn't find it. I did a search on my user name and it doesn't show up. Where did you find the other posting of the question ? Not being able to remember where you multi-posted the same question is another good reason to carefully choose a single, appropriate group to use. Your first post was to the formscoding newsgroup, but beacuse that is not particularly appropriate place to ask a question about a report, let's forget that thread and continue this one. Here's a copy of my reply: ---------------------------------------------------------------------------- Actually, that's not what you want to do ;-) First, you almost never use the .Text property in Access, it is only useful in special situations. Use the .Value property instead, but since it is the dafault property of data controls, you do not need to specify it. OTOH, even if you used the correct property, it wouldn't work because you can not "push" values into a report. Reports operate asynchronously, so you can not control the timing and other processing that's done by a report. Finally, you should not use the Report_reportname syntax. It refers to the default instance of the report's class module and even if it works in many situations, it really serves a different and rather special purpose. Instead, you should use the Reports!reportname construct. If you had used this sybtax, you would have immediately noticed that the report must be open before you can access it (even if what you want to do won't work). This is another, roundabout way, of saying that you can't "push" values into a report. You should set things up so the report sets its own properties/values. For the properties that position the text boxes, put the code in the report's Open event. Setting a control's value should be done in the control section's Format event. To let the report know what table you want it to use, pass the its name to the report in the OpenReport method's OpenArgs argument. -- Marsh MVP [MS Access] |
Thread Tools | |
Display Modes | |
|
|