Dear All,
I need to replace button captions to get the values from table based on criteria
Code:Private Sub Form_Load() On Error Resume Next Dim rst As Recordset Dim ctl As Control Set rst = CurrentDb.OpenRecordset("Select * from products where easy =-1"): rst.MoveLast: rst.MoveFirst For Each ctl In Me.Controls If Not rst.EOF Then ctl.Caption = rst(3): ctl.Tag = rst(1): ctl.Enabled = True: ctl.Visible = True: ctl.OnClick = "" rst.MoveNext Else ctl.Visible = False End If Next End Sub