Continuous Form (1 Viewer)

atiqahmed

New member
Local time
Today, 07:08
Joined
Mar 17, 2021
Messages
22
Hello everyone hope you all are doing well, i want to design attached image form in ms access, i have tried a lot but couldn't find the solution, can anyone please help me to suggest how to design this dynamic form which is based on table records which name is tblproduct, condition is that when any new product added on table it should be appear as command button just like image form button. please help me to design.

thanks alot
image is attached for your reference.
 

Attachments

  • 271279747_2187375074736462_4708932784823313134_n - Copy.jpg
    271279747_2187375074736462_4708932784823313134_n - Copy.jpg
    363 KB · Views: 232

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:08
Joined
Oct 29, 2018
Messages
21,455
Hi. I think one way to do that is to use a subform for the data. To see what I mean, take a look at a Calendar Demo that uses a subform to display the dates.
 

atiqahmed

New member
Local time
Today, 07:08
Joined
Mar 17, 2021
Messages
22
Hi. I think one way to do that is to use a subform for the data. To see what I mean, take a look at a Calendar Demo that uses a subform to display the dates.
will you help me to design this form...
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 22:08
Joined
May 21, 2018
Messages
8,525
You need to do this with a temp table. If you want 5 columns you will need 5 fields for image paths and 5 for the labels. Your form would be image control then label repeated 5 times. Now loop table products filling the temp table with the 5 records per row.

Your other option is to make this unbound with more controls then you would ever need. Show as many as needed. If the data is increasing rapidly then not really an option.

IMO creating controls dynamically is not viable in Access.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:08
Joined
Feb 19, 2002
Messages
43,233
The simplest way to do this is to use a report. A report supports columns. A form does not.

I have done this with a bound form by using 5 subforms. One for each column. You need to figure out what criteria you need to fill each column correctly. To make the form look right, the labels for the data fields are on the main form rather than each subform.
5AccrossSubforms.JPG
 

isladogs

MVP / VIP
Local time
Today, 03:08
Joined
Jan 14, 2017
Messages
18,209
Following on from Pat's reply, you can also use a report as a subform to get that type of effect in a form
 

atiqahmed

New member
Local time
Today, 07:08
Joined
Mar 17, 2021
Messages
22
thanks a lot all of you for your suggestions but still i couldn't find the way to design the form as image have. someone has designed already in ms access. it is possible with vba code but i m searching..
 

GPGeorge

Grover Park George
Local time
Yesterday, 19:08
Joined
Nov 25, 2004
Messages
1,829
IMO creating controls dynamically is not viable in Access.
It's hard to do, but even more importantly, there is a lifetime limit on the number of controls a form can ever have. That limit is, IIRC, 755 or 756.
That limit is cumulative. If you add twenty new controls a day, and replace them with new controls the next day, you'll hit that limit in around 37 or 38 days.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 22:08
Joined
May 21, 2018
Messages
8,525
@atiqahmed,
Do you have to have all buttons visible at one time or can you should about 20 and then scroll to the next group of 20? If so this would be done with an unbound form where you load 20 at a time. That actually looks like what is done in the image.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 22:08
Joined
May 21, 2018
Messages
8,525
If I was doing about 20 at a time (no more) then I probably do this unbound. In this demo I load three at a time. It is a very simplistic demo, but you should be able to move forward and backward.
image control.jpg

For simplicity I stored the images in the gallery but they could be attachments or in a folder. I would recommend a folder.
Table1 Table1

IDDescriptionStockPriceImage
1​
Aspirin
200​
$1.00​
Img1
2​
Toothpaste
20​
$2.00​
img2
3​
Razor
50​
$5.00​
img3
4​
ToothBrush
3​
$1.50​
img4
5​
Beer
25​
$12.00​
img5
6​
Wine
100​
$10.00​
img6

Code:
Private Sub cmdPrevious_Click()
   If counter >= 3 Then
     counter = counter - 3
     LoadImages
   End If
End Sub

Private Sub Form_Load()
  GetRS
  LoadImages
End Sub

Private Sub GetRS()
  Dim strSql As String
  strSql = "Select * from table1"
  Set rs = CurrentDb.OpenRecordset(strSql)
End Sub
Public Sub LoadImages()
  Const Columns = 3
  Dim i As Integer
  rs.AbsolutePosition = counter
  ClearImages
  For i = 1 To Columns
    If rs.EOF Or rs.BOF Then Exit For
    Me.Controls("img" & i).Picture = rs!Image
    Me.Controls("lbl" & i).Caption = rs!Description & vbCrLf & rs!stock & vbCrLf & rs!Price
    If Not rs.EOF Then
      rs.MoveNext
    Else
      Exit For
    End If
  Next i
End Sub
Public Sub ClearImages()
  Const Columns = 3
  Dim i As Integer
  For i = 1 To Columns
    Me.Controls("img" & i).Picture = ""
    Me.Controls("lbl" & i).Caption = ""
  Next i
End Sub

Again this is very simplistic demo, of an approach. It would require more code to make it a feasible solution
 

Attachments

  • LoadImages.accdb
    2.6 MB · Views: 191

Knives

New member
Local time
Today, 10:08
Joined
Feb 19, 2020
Messages
6
Hello everyone hope you all are doing well, i want to design attached image form in ms access, i have tried a lot but couldn't find the solution, can anyone please help me to suggest how to design this dynamic form which is based on table records which name is tblproduct, condition is that when any new product added on table it should be appear as command button just like image form button. please help me to design.

thanks alot
image is attached for your reference.
Have you find solution to this problem?

He is right, the biggest problem in this case is the limitation of the controls that can be used inside a form.
It's hard to do, but even more importantly, there is a lifetime limit on the number of controls a form can ever have. That limit is, IIRC, 755 or 756.
That limit is cumulative. If you add twenty new controls a day, and replace them with new controls the next day, you'll hit that limit in around 37 or 38 days.


I've tried something else here... where I only used one control under a tabular form... It can accommodate unlimitted number of records...

1676469043449.png
 

Knives

New member
Local time
Today, 10:08
Joined
Feb 19, 2020
Messages
6
Have you find solution to this problem?

He is right, the biggest problem in this case is the limitation of the controls that can be used inside a form.



I've tried something else here... where I only used one control under a tabular form... It can accommodate unlimitted number of records...

View attachment 106467
Here's the MS-Access .accdb file so you can try and modify it according to your needs...
 

Attachments

  • DisplayImage.accdb
    768 KB · Views: 54

Users who are viewing this thread

Top Bottom