Modules & VBA :: Calling On Current Event Of Another Form

Apr 20, 2015

I want to call the "On Current" event of another form.

I have a parent(mainform) form and then I have a subform(CurrentForm) and in that subform(CurrentForm) I have another subform(mysubtab01). From the mySubTab01, I want to call the On Current of the parent form. How can i do this?

This is an example of how I am setting the record source of the deepest subform where I want to call the parent on current from:

Forms(mainform)(CurrentForm)(mySubTab01).Form.Reco rdSource = "Select * from subQrytab03"

View Replies


ADVERTISEMENT

Modules & VBA :: Form Won't Go To New Record On Current Event

Jun 3, 2015

I have a form with a subform. In the form's On Current event I have the subform's visible property set to false. There is a button that when clicked sets the subform's visible property to true. I want the subform to go to the first control in a new record which is a combo box. the subform is a multiple items form. I have tried the GoToControl in the subforms OnCurrent event, but it is not working. I get an error saying the database cant find a third form.

View 4 Replies View Related

Modules & VBA :: Form Current Event Error 438

Jul 28, 2015

I have error 438 Object doesn't support property or method in a Form On Current event.

Error trapping is turned on, reason being I converted the form to accde and it stopped working!

The code is...

Private Sub Form_Current()
On Error Resume Next
Dim ctl As Control
'Me.CC_Spare_3.Enabled = False
For Each ctl In Me.Controls

[Code] ....

The highlighted text when in debugger is

ctl.Locked = Me![Check411]

View 4 Replies View Related

Calling A Subform Event From The Main Form.

Sep 27, 2006

I have a main form with a subform. I need to update values in the subform when a field on the main form is updated using afterupdate on that control.

Example:
main form name: mainform
control name: gst (on main form)

subform name: subform
records displayed as datasheet.
records field to update: retail

In main form gst control afterupdate event:
Me.[subform].[Form].retail_afterUpdate

Hoping to call the afterUpdate procedure on the retail field.

Error message:
Method or data member not found.

View 2 Replies View Related

Modules & VBA :: ActiveX Control Events Aren't Raised While Calling Its Methods From The Open Event

Oct 9, 2013

We have an ActiveX grid control, 10Tec iGrid, written in VB6. One of its method, Group, used to group rows, raises the AfterAutoGroupRowCreated event so the developer can adjust the look and contents of every group row created during the automatic process of grouping.

When our ActiveX grid is hosted on an MS Access form and we call the Group method while populating the grid in the form's Open event, the AfterAutoGroupRowCreated event isn't triggered. But this event definitely works as expected in other development environments, and even in MS Access if we call Group from the form's Load event.

Is it a well know issue of MS Access, when any events of ActiveX controls aren't triggered while "executing" the Open event

View 1 Replies View Related

Modules & VBA :: Error (Invalid Use Of Null) In A Function Called From A Form Current Event

Nov 18, 2013

I am struggling trying to execute a function inside a Form_current event to display some stats.

The Function is this:

Code:
Function FlightsByAircraft(Aircraft As Long) As Long
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim str As String
str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft

[Code] ....

The code for the Form_Current event is this:

Private Sub Form_Current()
txtStats1 = FlightsByAircraft(Me.AircraftID)

Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:

Code:
If IsNull(Aircraft) then
exit function
else
.... (the DAO.Recordset code)

but it doesn't work.

View 8 Replies View Related

Modules & VBA :: How To Pause Code When Calling Custom Message Box Form

Feb 9, 2014

I have created a custom message box form that suits my needs for this particular situation. It is called (opened) in the middle of a bunch of other VBA procedures. What I am having a problem with is how do I "pause" the rest of the code from running after the message box call?

For example, with a regular msgbox() function, once called, the code will wait for the user input or click of a button, then continue. My problem is that I am using the basic docmd.openform procedure, and it opens the message box form just fine, but then continues on with the rest of the code after the form is opened.

How would I "pause" the code after the call of opening my custom message box form, then continue it after the user clicks one of my closing buttons from that form?

Furthermore, although its not entirely needed in this situation, for future reference, how would I have that message box form return a value to the calling procedure?

View 14 Replies View Related

Modules & VBA :: Calling RDL File To Generate Reports From A Form Control Button In Access

Dec 2, 2014

So Access was unable to manage the amount of content that I needed to produce in a single report. The reports contain 12 charts/graphs all of which I needed on separate pages (one chart per page). As such I could not create large enough charts in access to fit to each page, as Access limits the amount of space one can use in a report.

I downloaded Microsoft Reports Builder 3.0 and built my reports as needed and can generate them as desired at current. I'm wondering if there a way to call that RDL file I created to generate my reports from a form control button in Access?

View 3 Replies View Related

On Current Event Problem

Aug 12, 2006

Hi

I have a form frmCurrency with two buttons one called GBP and the other EURO.

On clicking any of the two buttons a second form frmInvoice opens on a new record and a check box called Euro therein is set.

The purpose of ths is only to set the sign ie € or £ not convert the value.


'GBP button On Click
Dim stDocName As String

Dim stLinkCriteria As String

stDocName = "frmInvoice"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Forms!frmInvoice!Euro = False
RunCommand acCmdSaveRecord


or


'EURO button On Click
Dim stDocName As String

Dim stLinkCriteria As String

stDocName = "frmInvoice"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Forms!frmInvoice!Euro = True
RunCommand acCmdSaveRecord


Then I have placed the following code on the On Current Event of the opened Form ie frmInvoice.


Dim E As TextBox
Set E = Forms!frmInvoice!Text65

Euro.SetFocus

If Me.Euro = True Then
E.Format = "€0.00"
Else
E.Format = "£0.00"
End If


It works but it sets all the records. I only require the new record created to be set the other existing record values will not change.

ViRi

View 2 Replies View Related

Modules & VBA :: Options For Calling A Subroutine

Jan 14, 2015

Imagine I have two subrountines:

Code:
Private Sub DoSomething1()
[Do Something]
End Sub

Private Sub DoSomething2()
[Do Something]
End Sub

And this Declaration:

Code:
Dim str As String
str = 1

Is it possible to refer to/call one of these subroutines using something like this:

Code:
("DoSomething" & str)

View 1 Replies View Related

Modules & VBA :: Calling Variables From Other Subs

Oct 29, 2014

I have been tasked to create a multi-keyword search form, however, my form isn't working right and only the first record of the table is opened.

Code:
Public Sub txtSearch_AfterUpdate()
Dim strWhere As String
Dim strWord As String
Dim varKeywords As Variant
Dim i As Integer
Dim IngLen As Long

[Code] .....

These are the codes that I am using for my search form. I have a feeling that I am not calling the variable from the after update portion the right way.

View 14 Replies View Related

Modules & VBA :: Calling Function From Sub Routine

Aug 10, 2013

I have 28 combo boxes on a form, which I want to insert data into the table as they are changed. Each one will pass the same sets of data just with different parameters which come from the form.

Rather than putting the same code to insert on each of the 28 combo boxes I thought it would be easier to create a function to do it and pass the parameters to it through a sub on the AfterUPdate event of the combo box.

I need to pass 4 parameters, if I only put 1 in there it works fine, but when I start putting more in it doesnt work and I get compile errors or syntax errors.

Sub routine:

Code:
Private Sub cboMonday1_AfterUpdate()
If Me.cboMonday1 = 1 Then
Me.cboMonday1.BackColor = vbGreen
Me.cboMonday1.ForeColor = vbBlack

[Code] .....

View 9 Replies View Related

Added Current Time On Click Event

Mar 5, 2008

I have two fields in my form contained Start time and End time. Currently, Both fields using default Time$() on form. However, End time always wrong because until we get our job done, It took atleast 20 or 30 minutes more than current default time. My question is, is there any way I can setup the End time to just click on it, and a new current default time populated?

Thanks in advance..

View 3 Replies View Related

Forms :: Bookmark And Subform In Current Event

Nov 2, 2013

I have in the current event:

Private Sub Form_Current()
If Not Me.NewRecord Then
With Me.Q_Subform.Form
.RecordsetClone.FindFirst "N=" & Me.N
.Bookmark = .RecordsetClone.Bookmark
End With
End If
End Sub

The problem is that when the Q_Subform has no records I have the error 3021.

How can manage it. It's the last step before ending My db

View 3 Replies View Related

Modules & VBA :: Calling A Function And Passing Variables

May 29, 2015

I have never tried passing variables while calling a function so I don't know what the heck I'm doing. I'll give a simplified example of what I'm trying to do. The second variable vRank is reporting properly but the first one vID gets "stuck" on whatever the first item in the listbox is.

Code:
Dim vrt As Variant
Dim upSQL As String
For vrt = 0 To Me.List1.ListCount - 1
If Me.List1.Selected(vrt) = True Then
Call ChangeUp(Me.List1.Column(0, vrt), Me.List1.Column(1, vrt))

[Code] ....

View 3 Replies View Related

Modules & VBA :: Calling Stored Procedure With Parameters

Dec 2, 2013

I have code for calling stored procedure with parameters,which is as follows

Dim qdf As DAO.QueryDef, rst As DAO.Recordset
Dim IdValueToProcess As Long

IdValueToProcess = 221177 ' test data
Debug.Print (IdValueToProcess)
Set qdf = CurrentDb.CreateQueryDef("")

[Code] ....

And my stored procedure is

Code:
ALTER PROCEDURE [dbo].[spItemDesc]
@ItemNo varchar(200) ,
AS
BEGIN
set nocount on ;
select ProductDesc1,ProductDesc2 from ProductDatabase.dbo.tblProductInfo where ProductNumber = @ItemNo
END

The error comes on debug.print(rst!ProductDesc1)

And it says "Item not found in the collection"

View 2 Replies View Related

Modules & VBA :: Putting A Form BeforeUpdate Event

Jul 19, 2013

I have On Load, Current, After Update events on a form, which all work fine. But, when I add a Before Update, I get the error: "Procedure declaration does not match description of event or procedure having the same name". Following is my code:

Code:

Private Sub Form_Load()
If InStr(Me.Filter, "=") > 0 Then
If IsNumeric(Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "="))) Then
Me.Tag = (Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "=")))
End If
End If

[code]....

View 3 Replies View Related

Modules & VBA :: Form Event To Update Stock?

Nov 14, 2014

I have an order form with an order details sub form. Both are bound to their respective tables and function correctly, with the OrderID being inserted automatically into the order details table.

However I am using VBA to update and check stock and have it working when attached to a separate form called process orders. Which event would be the best place to place this code. I do not really want to have the process orders form. Would it be on the master form or the sub form. I thought of placing it in the after insert event on the subform, but there can be many order items per order and it will run before I have finished adding order items. I tried it in the after insert event on the master form, but I think that this will run the code too soon as at this stage the order details will not have been written to that table.

View 4 Replies View Related

Modules & VBA :: Place If Statement In AfterUpdate Event On Form

Nov 13, 2014

I'm trying to place an if statement in an afterupdate event on a form. The code I have is

Code:
If [Customer] Like "BRO001" And [Inv No] is null Then [Job_Price] = [Shots] * 27.5

this gives me a run time error, object required and highlights

Code:
If [Customer] Like "BRO001" And [Inv No] Is Null Then

I'd like the code to do nothing where the requirements to alter the job price are not met.

View 5 Replies View Related

Modules & VBA :: Call Text Box OnExit Event From Another Form

Jun 26, 2013

I was wondering if you can call a textboxes onExit event from another form? On my form a user enters a search criteria into a text box and when they exit the textbox the results are displayed in a listbox. This form is a subform on my main form. I want to be able to call this onExit method from the main form. Is that possible? When I put in txtSearchBox_Exit, I got an error saying Sub or Function not defined.

View 5 Replies View Related

Modules & VBA :: Creating One OnClick Event For All Labels On Form

Mar 18, 2014

I would like to make clickable labels on my form, so if the user has any questions about the field, clicking on the label would bring up a message box that would give them more information. I know how to write onclick events one by one for every label, but there are a lot of them, and I feel like there has to be a better way.

I put the label names, and the text I'd like for the message box in a table, and I'd like to have a module that will allow me to click on a label, and have the right text come up.

I've researched ways to do this and have come up with nothing. The farthest I've gotten is an array tied to the form open event that just displays all the message boxes from first to last, one after the other. I believe that's on the right track, but is not a workable solution as is. I need to be able to tie the message box to the actual label the user clicks.

View 4 Replies View Related

Modules & VBA :: Form OnCurrent Event Not Firing Properly

Aug 7, 2014

We use our CRM for entering client orders, which is done through our 'OrderEntry' form. On that form we have a subform that we use to enter order lines - as we have a range of products on offer, an order can be made up of one product or anything up to 100.We have an 'amount' textbox on the subform, that the users enter the cost of each line, and as they add more lines the total cost of the order is calculated using a textbox in the subform Footer, with the ControlSource set to =Sum([amount]).

On the main form, we have a Net textbox, that the user will add in the total cost of the order once they've added all the order lines, and providing the =Sum([amount]) textbox on the subform matches the figure in the Net textbox, a button to Proceed the order and go on to the next step appears.

The intermittent problem I have, is that the OnCurrent event I use to show the Proceed button does not seem to fire on its own - but when I stop the code and step through it, it will show the Proceed button without any problems.Here's the code:

(the Proceed button is referred to a 'Command80')

Code:
Dim OS As String
Dim UT As String
OS = OrderStatus
UT = fGetUserType

[code]....

I've made the part that refers to the Proceed button bold, but thought I'd add in the whole OnCurrent event in case there was anything in there that was blocking it.

I added in the MsgBox code at the bottom to make sure the OnCurrent was firing, and that works fine.I've searched through the rest of the code, and there's nothing else in there that references the Visible property of the button.I've been through the decompile process detailed here, and also been through this similar thread with a fine toothcomb and this still won't work.

I've saved the form out as a textfile and then imported it back in, both through the immediate window, and short of importing everything in to a new DB and starting again

View 14 Replies View Related

Modules & VBA :: Resetting Event Procedures For A New Record In Form

Sep 10, 2014

I have the following Event Procedures in a form:

Private Sub PrimaryDisability_Change()
Select Case Me.PrimaryDisability
Case "Other (Specify)"
PrimaryOther.Visible = True
Case Else

[Code] ....

My problem is that when I go to a new record, the fields that I want hidden in the new record unless they meet the criteria are still visible. I have looked all over online and in books to determine the code I use or whatever I need to do to make the field invisible in the new record and only to appear in each record if it meets the criteria.

View 13 Replies View Related

Modules & VBA :: OnLoad Event To Change Icon Of The Form

Sep 26, 2014

I currently use code in a module and code on each form in the on_load event to change the icon of the form.. the code i use is as follows..

in a module:

Code:
Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const WM_SETICON = &H80
Private Const IMAGE_ICON = 1
Private Const LR_LOADFROMFILE = &H10
Private Const SM_CXSMICON As Long = 49
Private Const SM_CYSMICON As Long = 50

[Code] ....

And on each form on load:

Code:
SetFormIcon Me.hWnd, "k: est directoryhsicon.ico"

What I am wondering is would it be possible to store the .ico file within the DB file itself (i know access can store bitmaps) and reference the .ico in the form load event code?

Overtime the db file will probably move to its own dedicated storage so using a direct reference to the file wont work..

I have tried the following but get an error (it tries to reference the .ico file as to being in the root directory of the db file)

Code:
SetFormIcon Me.hWnd, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & "hsicon.ico"

View 2 Replies View Related

Modules & VBA :: Calling Public Function To Backup / Compact Back End?

Dec 23, 2013

I have the following function that I found online. Unfortunately I can't remember where I got it since I've had it for a little while. Today, when I tried to actually put it to use it didn't work.

I'm calling it from a form as follows: CompactDB (tblHotword)

tblHotword is just a random table from the back end. My understanding of the function was that it would use that table to connect and get the file name of the back end.

Whenever I run it, Access pops up a window that says "Object required" and nothing else. It doesn't look like a standard error message popup. When I click 'OK', Access continues with the rest of the code as if nothing went wrong. The function doesn't run though.

Code:
Public Function CompactDB(TableName As String) As Boolean
On Error GoTo Err_CompactDB
Dim stFileName
DoCmd.Hourglass True
stFileName = db.TableDefs(TableName).Connect

[code]....

View 8 Replies View Related

Modules & VBA :: Calling Stored Procedure From Access Gives Run Time Error

Nov 27, 2013

I am trying to call a stored procedure from access ,but it is giving me this runtime error :

Code:
2147217900
Syntax error or access voilation

I am doing this first time so i dont know about how to pass parameters (IN and OUT)..

My code is

Code:
Public Sub createDataToAnalyze()
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command

[Code].....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved