Using "tiles"

X

XPS350

I am trying to build a form with “tiles” (like in Windows 8, Android orIOS). The number of tiles will be variable but limited and depends on selected data.
My idea is te create a form with a number of buttons (Knop1 to KnopN), which will initially be invisible. Depending on the number of data selected some of the buttons will be made visible. So far I have the code below to makethe buttons visible and assign a text to each button.

Dim rs As Recordset
Dim Knop As String
Dim Tel As Byte

Set rs = CurrentDb.OpenRecordset("SELECT * FROM MyTable")
Tel = 0

While Not rs.EOF
Tel = Tel + 1
Knop = "Knop" & Tel

With Forms("Formulier1").Controls(Knop)
.OnClick = "[Event Procedure]"
.Caption = rs!MyValue
.Visible = True
End With

rs.MoveNext
Wend

My problem now is to create an event procedure for a button. The procedure could be for opening a new form based on a value found in the recordset. Sosomething like:
DoCmd.OpenForm "NextForm", , , , , , rs!Myvalue

Any help will be appreciated.
 
L

LightByrd

XPS350 said:
I am trying to build a form with “tiles” (like in Windows 8, Android or
IOS). The number of tiles will be variable but limited and depends on
selected data.
My idea is te create a form with a number of buttons (Knop1 to KnopN),
which will initially be invisible. Depending on the number of data
selected some of the buttons will be made visible. So far I have the code
below to make the buttons visible and assign a text to each button.

Dim rs As Recordset
Dim Knop As String
Dim Tel As Byte

Set rs = CurrentDb.OpenRecordset("SELECT * FROM MyTable")
Tel = 0

While Not rs.EOF
Tel = Tel + 1
Knop = "Knop" & Tel

With Forms("Formulier1").Controls(Knop)
.OnClick = "[Event Procedure]"
.Caption = rs!MyValue
.Visible = True
End With

rs.MoveNext
Wend

My problem now is to create an event procedure for a button. The procedure
could be for opening a new form based on a value found in the recordset.
So something like:
DoCmd.OpenForm "NextForm", , , , , , rs!Myvalue

Any help will be appreciated.

Don't know how much help this is but buttons have an on_click event.
From there you could create a macro or a VBA code procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top