Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi column form 1

Status
Not open for further replies.

dwalker

Technical User
Nov 29, 2002
34
I need to create a form which displays each record across the screen, rather than down the screen. Perhaps even automatically wrapping. I'm aware it's possible to create multi column reports, but what about forms?
 
Hi,

The 'multi-column' reports you refer to are probably 'cross-tab' query supplied data.

With a form, a record is displayed one at a time.
i.e. a form gets one record and displays it.

A form IS basically the SINGLE record it displays.

To display many records on a form, you need subforms.

If the number of records is dynamic (unknown and ever increasing) then forget it.

Why display across rather than down (as in continuous) anyway?

Regards,

Darrylle



"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." AND "A pointer to a solution is better than the solution - you'll remember the solution via a pointer". darrylles@totalise.co.uk
 
Hi dwalker and Darrylles,

Please take a look at Thread705-423324 , might be of help.
 
Hi Bill,

Seen this already, thought it may be a bit in-depth.

However, the solution IS there.

On ya go DW.

Thnx Bill.



"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." AND "A pointer to a solution is better than the solution - you'll remember the solution via a pointer". darrylles@totalise.co.uk
 
Darrylle

What I'm trying to produce is a database of image files which I want to display as thumbnails across a form - parhaps 4 or 5 thumbnails per line. The path to each image is stored in a table along with other descriptive fields. It's simple enough to display each sequentially down the page but with hundreds of images on file I end up with an absurdly long form.

Since posting I've developed a work-around which runs code each time the form opens - the code runs through the entire table and assigns a row_number and column_number to each record then runs a crosstab query which presents the records exactly as I want them. My form is then based on this crosstab and it works like a charm.

Trouble is, the first row of thumbnails work perfectly, but as the second row appears and gets it's image_path data from the query the first row of images takes on the properites of the second row (am I making sense?!) which means I end up with hundreds of rows of the same 4 pictures! What I need now is some way of making the image controls "keep" the values they are assigned rather than updating with each new row.

I think I might give up. I haven't read the thread posted by Bill above in detail yet so fingers crossed the solution is there.

If you'd like to see the detail behind how I've managed to get the records to appear across the form then post back and I'll put it up.

Regards

Damien
 
Hi dw,

Never did quite catch-on to that: 'give up' thing, maybe you could teach me. (lol)

Post the code - if it's massive, try to post the 'meat' of it.

I'm interested, because a 'property' can't change at any stage without being changed via code.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Darrylle

The problem I have goes like this:

I have a form with 4 image controls "imgCtrl1" to "imgCtrl4" presented across the form. The control source for the form is a crosstab query whith a datasheet that looks something like.....

[row_num] [1] [2] [3] [4]
1 path1 path2 path3 path4
2 path5 path6 path7 path8
3 path9 path10 path11 path12

(path1 etc. is actually a DOS path like "C:\picture.jpg")

Code run during the OnLoad event looks something like....

imgCtrl1.Picture = [1].Value
imgCtrl2.Picture = [2].Value
imgCtrl3.Picture = [3].Value
imgCtrl4.Picture = [4].Value

And this works perfectly. imgCtrl1 displays the picture at path1, imgCtrl2 displays the picture at path2 etc.

The problem is, the 2nd and 3rd rows of pictures are identical to the first because each row on a continuous form comprises the same controls as each other row. i.e. the controls on row one are imgCtrl1, imgCtr2 etc AND the controls on row 2 of the form are also imgCtrl1, imgCtrl2...

See what I mean?

I'm sure I'm approaching this from completely the wrong angle.

Regards

Damien
 
Hi,

Your onload event is the prob. Comment it out.
It is giving Acces literal values to put into every row - every row will be the same.

The field1,2,3,4 should be bound to fields in the underlying form query, so that when record 2 is read - field1 looks at record2.image1, field2 looks at record2.image2 etc.

May not be solved now, but get rid of that code first.

Regards,

Darrylles



"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Hi

You didn’t mention images in your first posting. You can find a working version of what I am trying to explain below at to download it select 181-428226.zip, to use the demo you will also need to download images.zip, extract these to c:\my documents\images.
Open the form frmTransposeImages to view the demo, to see how it works, view the form in design view, look at the form’s module. For help on any function/method you’re not familiar with, highlight it, then press the F1 key.

I hope the images that you want to use are bitmaps, otherwise you will get an annoying message that Access is loading the images. Though the overhead is much larger on your PC for bitmaps, 50 will easily load almost instantly on a Pentium x PC. This demo just uses 10 at a time, with a total of 38, I haven’t got broadband yet, anymore would have taked an age to upload for the demo. If you need any help on converting bitmaps from say jpeg let me know, I also have a little app that will up date your table with the new extensions.

If you decide to use the demo as a basis for your app, I will post an explanation of how it works at your request.
 
Don’t know what happened there, part of my posting didn’t get posted.

Make sure you backup your database before attempting this.

To test the Transposer Function (Thread705-423324 2nd posting down) put this code in the load event of a form:
----------------------------
On Error GoTo TransposerLoad_Err
Dim intControlCounter As Integer
Call Transposer("tblImages", "tblImages1", 10, 0)

----------------------------

tblImages > Your table where image name and location are kept.
tblImages1 > Names the table where you want the transposed image name and location to be kept .
10 > Create tblImages1 with 10 fields to a maximum of 255, below this is referred to as x.
0 > Position of the field in your table where image name and location are kept. Actual position – 1

Edit the above to reflect your own table name where your image locations are kept and what you want to name the transposed table. How many thumbnails you want to display on screen at a time. The (position – 1) of the field where the image name and location are kept.

Set the form’s Default View to Single Form.

Now, on your form draw, size and position an Image control. Set the Picture type to Linked. Delete the picture that you are forced to link to at first. Duplicate it x - 1 many times. Name them img1 to imgx. Position them right to left and then down, right to left etc, so that they fill the screen. Keep them in order e.g. img1 – img6, img7 – img12 etc.

Next create the same amount of Text Boxes, place them out of the way, maybe on the form’s footer. Name them txtImage1 to txtImagex. Hide them.

Paste this into your form’s load event, below the the Transposer Function:
----------------------------
Me.RecordSource = "tblImages1" ‘replace tblImages1 with the name you’ve used.
intControlCounter = 0
While intControlCounter < 10 ‘replace (10) with x, this names the control sources for the form’s text boxes
intControlCounter = intControlCounter + 1
Me.Controls(&quot;txtImage&quot; & intControlCounter).ControlSource = intControlCounter
Wend
Exit Sub
TransposerLoad_Err:
MsgBox CStr(Err) & &quot; &quot; & Err.Description

----------------------------

Paste this into your form’s current event:
----------------------------
Dim intImageCounter As Integer
intImageCounter = 0
While intImageCounter < 10
‘replace (10) with x
intImageCounter = intImageCounter + 1
If IsNothing(Me.Controls(&quot;txtImage&quot; & intImageCounter)) Then

‘IsNothing Function can be found at Thread181-427974 or replace with IsNull
Me.Controls(&quot;img&quot; & intImageCounter).Picture = vbNullString
Else
Me.Controls(&quot;img&quot; & intImageCounter).Picture = Me.Controls(&quot;txtImage&quot; & intImageCounter)
End If
Wend

‘When the form loads or you change page (really a record) this procedure re-references the Image Pictures to the text in the relevant Text Boxes.

When you open the form, you should have x amount of images shown, click next and another x amount etc., play around with it until your happy.
 
Billpower

Sory for the delay in replying to your post - I've been on leave for a while.

Your 'Transposer' logic is a similar to what I do already -create a new table with the values transposed.

The real value (to me) in your solution is the notion of then treating each record as a &quot;page&quot; on the form and updating the controls with the On Current event each time you change page. I hadn't thought of that and it's an excellent solution.

Thanks very much for your help, I'm well on my way now.

Damien
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top