dears
hope you are fine, i am trying to create appointment using on click event in vba, i decided to create a form , writing all codes in design view, then, a record set to read input from a table, then, for each input , i create a button to be placed in a graph, based on the time it was scheduled and a certain date, it took me time but finally i managed to create a dynamic form, the start of the form is the first appointment and the end is the last one, long story short, i am stuck now, on clicking on the specific button , to be able to open the appointment again , change it or confirm it.
here are the steps of the code.
i want the click to a specific button to open form as per the below with the below where condition.
each button has on click different than the other one.
please check the attached pictures.
any proposal please?
the highlighted one on the table is the same as the one on the from and the same as the one on the graph.
in another word, how to program when we create a button from Set ctl = CreateControl"form3", acCommandButton , and dedicate for each button a special docmd.openform "MyForm" where studentID=anynumber and idfromMain=anynumber and IDfromapprovedsession=anynumber?
your support is much appreciated
hope you are fine, i am trying to create appointment using on click event in vba, i decided to create a form , writing all codes in design view, then, a record set to read input from a table, then, for each input , i create a button to be placed in a graph, based on the time it was scheduled and a certain date, it took me time but finally i managed to create a dynamic form, the start of the form is the first appointment and the end is the last one, long story short, i am stuck now, on clicking on the specific button , to be able to open the appointment again , change it or confirm it.
here are the steps of the code.
Code:
Set BSS = db.OpenRecordset("select * from ConsultationScheduletbquery)
BSS.MoveFirst
Do Until BSS.EOF
Set ctl = CreateControl("form3", acCommandButton, acDetail, , , f, 1440 + n, BSS!txttimediff * 24, 700)
f and n to control the position of the buttons
ctl.Caption = BSS!FullName
IDfrromapprovedsession =BSS!IDfrromapprovedsession
IDfrommain=BSS!IDfrommain
studentID=BSS!studentID
i want the click to a specific button to open form as per the below with the below where condition.
Code:
ctl.OnClick = "docmd.OpenForm(ApprovedSessionsTbQueryform where IDfrromapprovedsession = 25 and IDfrommain=443 and studentID=121)" these numbers are obtained from the BSS move next,
please check the attached pictures.
any proposal please?
the highlighted one on the table is the same as the one on the from and the same as the one on the graph.
in another word, how to program when we create a button from Set ctl = CreateControl"form3", acCommandButton , and dedicate for each button a special docmd.openform "MyForm" where studentID=anynumber and idfromMain=anynumber and IDfromapprovedsession=anynumber?
your support is much appreciated
Last edited by a moderator: