Controlbutton settings

Hi, I have a little big problem. (I am a beginner)

So : I made in access a form wich contains several control buttons, which are linked to a table. each button has the name (original) Command + number

there are 4 main buttons, which charge a specific table when you click on them. so far so good.

these tables are a listing of types. each type has a name and a code

I search a value with Dmax

Now I need :

1) a series of invisible buttons from 1 to Dmax value to become visible and to take the caption of the type. this always goes wrong.

2) to set a value for each button to activate the query which makes appear the next control buttons.

Can somebody help me

Thanx



Answer this question

Controlbutton settings

  • CoreyMasson

    THX

    works wonderfull :-)


  • millerfj

    Ok, I will narrow the problem down

    For start = 21 To Dmax(expression) + 1
    Buttonnumber = start
    DoCmd.GoToRecord acDataTable, , acGoTo, start
    Buttoncaption = [Type]
    Buttonname = "Me!Command" & buttonnumber
    Buttonname.Visible = True
    Buttonname.Caption = Buttoncaption
    Next start

    All my other problems are solved, except that here I get the errordescription that Buttonname is an "invalid qualifier" I dimmed it as string, perhaps I need to dim it otherwise, but I have no clue, or I need to ID it otherwise


  • eferreyra

    Hi TnTico,

    You could use the Controls container to achieve this.

    You would need to construct all of your buttons first to use this method.

    The construct me.Controls("Command" & start) will reference a control by the name of CommandNN where NN is a number, ie Command1, Command10 or Command101.

    For start = 21 To Dmax(expression) + 1
            DoCmd.GoToRecord acDataTable, , acGoTo, start
            me.Controls("Command" & start).Visible = True
            me.Controls("Command" & start).caption = [Type]
    Next start

    This should also work in VB.Net as well.

    I hope this helps.

    Regards

    Nigel


  • Controlbutton settings