I am stuck with a Event Procedure Issue. I have created one Dynamic report in MS access using VBA. For the same I have created some dynamic controls like lables, Textbox, buttons, etc. I am able to create report successfully. The only issue is that I don't know how to create "Onclick" Event procedure for Dynamically created button. Every Time I click on that button it gives me an errors which says " No such Event found" kind off.
Here is My Code... - Private Sub btn_createReport()
-
-
Dim btnNew As Access.CommandButton
-
Dim rpt As Report ' hold report object
-
-
cmdSelect = "select * from xyz;"
-
Set rpt = CreateReport
-
-
' set properties of the Report
-
With rpt
-
.Width = 12500
-
.RecordSource = cmdSelect
-
.Caption = title
-
End With
-
-
-
-
Set btnNew = CreateReportControl(rpt.Name, acCommandButton, acPageHeader, , , 7000, 50, 1500, 400)
-
btnNew.Caption = "Back"
-
btnNew.Name = "btnNew"
-
-
' btnNew.OnClick = "[btn_Click]"
-
'lblNew.FontUnderline = True
-
lblNew.SizeToFit
-
-
End Sub
-
-
Private Sub btnNew_Click()
-
DoCmd.OpenForm Form1, acNormal, , , , acWindowNormal
-
MsgBox "Hello"
-
End Sub
2 15790
I missed the Report part because I am running out the door, but here is how you can create an Event Procedure (Click()) for a Control (Command Button) named cmdDemo on the Current Form: - Dim ctl As Control
-
Dim mdl As Module
-
Dim frm As Form
-
-
Set ctl = Me![cmdDemo] 'Set a Reference to the Command Button
-
Set frm = Me 'Set a reference to the Form
-
Set mdl = Me.Module 'Set a Reference to the Form's Code Module
-
-
'Create a Click() Event Procedure for the Command Button cmdDemo
-
lngReturn = mdl.CreateEventProc("Click", ctl.Name)
-
-
'Insert a single Line of Code in the Event Procedure
-
mdl.InsertLines lngReturn + 1, "Msgbox ""Create Procedure Demo"""
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim Mitchell |
last post by:
I have some code behind that generates 10 imagebutton controls.... I can
not seem to figure out how to trap the onclick event for each image and
determine which image was clicked.
Can someone...
|
by: drawde83 |
last post by:
Hi,
I'm mocking up an interface in javascript for an HCI assignment. I want
to be able to make the default onclick event for the buttons on my page
to display an alert since the buttons won't work...
|
by: Hrvoje Vrbanc |
last post by:
Hello all!
My question is the following: I add buttons (server controls)
programatically into a table cell. Example:
Dim btObnovi As Button = New Button()
celija25.Controls.Add(btObnovi)
...
|
by: Diane Yocom |
last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but...
I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
|
by: Sandeep |
last post by:
Hi
I want to write onclick event on a button(a web control) ,also i want to
call a client side function on the click event
how to write that how to differentiate between these two events
...
|
by: tshad |
last post by:
Is there a way to change the onClick event of a LinkButton?
At the moment, I am using 2 buttons that I toggle the visibility on and off.
I would like to use just one button, if possible and just...
|
by: DataSmash |
last post by:
Hello,
I've created a simple form with 2 radio boxes, 2 text boxes and a
button.
When I click the button, I'd like to write each "choice" to a text
file.
I can't figure out how to "link" the...
|
by: Totto |
last post by:
Hi,
Anyone know the best solution to dynamically add buttons to a asp 2.0 page
using data from Sql server?
Are there any contols suitable for this or is it best to iterate the dataset
and...
|
by: Nathan Sokalski |
last post by:
I have a DataList which contains several LinkButtons, which are used to
select a category in my application. I want the currently selected category
to use a different CSS class. Here is an example...
|
by: sourcie |
last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz"
I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |