473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to place text boxes on a report according to co-ordinates from a table.

106 New Member
Hi,

I am trying to place several textboxes on a report with their absolute positions pre-defined and stored as numbers in a table, but I am having trouble acheving this.

recordsource of a report has the expected values.

on the report I have a textbox, 'txtCustCompany'
in the onprint event code, I have:
Expand|Select|Wrap|Line Numbers
  1. txtCustCompany.Left=me.CustcompanyLeft
  2. txtcustCompany=me.CustCompany
  3.  
But first line of code throws an error.
I am not sure which way to head.
Nov 2 '10 #1

✓ answered by ADezii

As an afterthought
Expand|Select|Wrap|Line Numbers
  1. Dim rst As DAO.Recordset
  2. Dim strControlName As String
  3.  
  4. strControlName = "txtCustCompany"
  5.  
  6. Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblCoordinates WHERE [Control] = '" & _
  7.                                    strControlName & "';", dbOpenSnapshot)
  8.  
  9. Me![txtCustCompany].Move Left:=rst!Left, Top:=rst!Top, Width:=rst!Width, Height:=rst!Height
  10.  
  11. rst.Close
  12. Set rst = Nothing

4 1658
ADezii
8,834 Recognized Expert Expert
  1. Let's assume that you have a Table named tblCoordinates with the following Fields:
    1. Control
    2. Left
    3. Top
    4. Width
    5. Height
  2. Copy-N-Paste the following Code into the Format() Event of the Detail Section to precisely position a Control named txtCustCompany:
    Expand|Select|Wrap|Line Numbers
    1. Dim strControlName As String
    2. Dim lngLeft As Long
    3. Dim lngTop As Long
    4. Dim lngWidth As Long
    5. Dim lngHeight As Long
    6.  
    7. strControlName = "txtCustCompany"
    8.  
    9. lngLeft = DLookup("[left]", "tblCoordinates", "[Control] = '" & strControlName & "'")
    10. lngTop = DLookup("[Top]", "tblCoordinates", "[Control] = '" & strControlName & "'")
    11. lngWidth = DLookup("[Width]", "tblCoordinates", "[Control] = '" & strControlName & "'")
    12. lngHeight = DLookup("[Height]", "tblCoordinates", "[Control] = '" & strControlName & "'")
    13.  
    14. Me![txtCustCompany].Move Left:=lngLeft, Top:=lngTop, Width:=lngWidth, Height:=lngHeight
Nov 2 '10 #2
ADezii
8,834 Recognized Expert Expert
As an afterthought
Expand|Select|Wrap|Line Numbers
  1. Dim rst As DAO.Recordset
  2. Dim strControlName As String
  3.  
  4. strControlName = "txtCustCompany"
  5.  
  6. Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblCoordinates WHERE [Control] = '" & _
  7.                                    strControlName & "';", dbOpenSnapshot)
  8.  
  9. Me![txtCustCompany].Move Left:=rst!Left, Top:=rst!Top, Width:=rst!Width, Height:=rst!Height
  10.  
  11. rst.Close
  12. Set rst = Nothing
Nov 2 '10 #3
tasawer
106 New Member
Thanks for this. Definatly the sort of solution I was looking for.
Nov 3 '10 #4
ADezii
8,834 Recognized Expert Expert
You are quite welcome.
Nov 3 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Mark | last post by:
Hi All, I have a report which is based on a query which is used to produce QC check sheets. I have quite a few text boxes which are used to display questions depending on the value of one...
8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
11
by: Edson Peacock | last post by:
I have a report with sub reports, one of the subreports have 12 text boxes that are 2" high and I want them all to grow if one goes to 3" high. If anyone has any suggestions they are very much...
4
by: ckpoll2 | last post by:
Hello, I have a report and am having a hard time summing some numbers. In the detail section of the report, I have 2 text boxes that have IIF statements in them. These IIF statements return...
5
by: John | last post by:
Hi I am using text boxes on a web form. How can I make it so users can insert values only in the format 99-99-99 ? Thanks Regards
2
by: Wernerh | last post by:
Hi guys, I must be the dumb one in these posts. I have 2 simple (2 everyone else out there) questions. I have just started using vb. I am able to use vb in excel with no problem and can code...
6
by: noe1818 via AccessMonster.com | last post by:
Just a quick question about lines: Is it possible to connect a text box (e.g. txtbx1 to txtbx2 and txtbx2 to txtbx3) with lines where txtbx1,2,&3 move up or down according to their values? Like...
2
by: kels | last post by:
Hi I've been searching all day on how to do this and I don't know how! I have tblEvents that store details of events that are created and contain info such as location, price and event name I...
5
by: ofilha | last post by:
I have created a report in design mode. However, some of the fields i need are dynamic. That is, i have a series of fields text boxes mostly that must show up only as needed. I also have some...
1
by: Hiker68 | last post by:
Hello, I am very new at Access & VBA so I hope you understand what I am asking. I have a form that displays information about an apartment building. I created a combo box to list all of the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.