Is Form Name Available In Called Module

Aug 27, 2015

Is the calling Form name or the event handler's sub name available in called module? I need it in order to determine the form's name as in [Forms]!someformname!some control.

View Replies


ADVERTISEMENT

Modules & VBA :: Undefined Function For A Module Called In A Query?

Sep 8, 2013

This module is giving me the "undefined function" error message when I try to run my query. I don't know why, but I have checked that there are no references with "missing" and there are not. I also added the word "Public" to the function becasue that was advised by another forum user. I thought it worked perfectly the first time I ran this query, but now it is not working and I do not recall making any changes. I have called the module basFunctions:

Option Compare Database
'************************************************* *********
'Declarations section of the module
'************************************************* *********
Option Explicit
'================================================= =========
' The DateAddW() function provides a workday substitute
' for DateAdd("w", number, date). This function performs
' error checking and ignores fractional Interval values.
'================================================= =========
Public Function DateAddW(ByVal TheDate, ByVal Interval)
Dim Weeks As Long, OddDays As Long, Temp As String

[code].....

View 3 Replies View Related

Whether To Code In A Form Module Or A Standard Module?

Dec 14, 2007

I'm wondering how other members here make decisions whether they want to place codes behind form or use a standard module instead.

I understand there is a performance penalty when you add another module (and use it), but am not sure whether one big fat module would be faster than several smaller modules with identical coding.

Furthermore, I know that some members use a hidden form to deal with startup and shutdown processing. Sometimes the processing has nothing to do with forms and would make more sense in a standard module, but since the form is already loaded, does it makes more sense to use the module behind the form than calling a function in a separate standard module to execute the needed code?

So, what do you tend to do in such situation?

View 14 Replies View Related

How To Propagate CB Value To Another Called Form

Aug 11, 2011

Is there an easy way to propogate a value from one form to another?

I have two forms: Form A and Form B

Form A is the main: it contains many field including a Supplier CB.
Form B allows the user to add a new supplier if it is not on the list..

Form A allow user to pick a list from the table of suppliers. I allowed edit ietm list in the properties to add the list of suppliers to grow as new supplier are entered. I pointed the user to Form B ton enter the new supplier.

Things going well as I planed, however it is annoying when I enter the new supplier in Form A and respond "yes" to add new items I have to retype the new supplier in Form B again. I have about 11 fields in Form A that will follow this theme. This will not be user friendly if not fixed.

View 4 Replies View Related

Table Locked When Trying To Update Via Code Called By A Form

Oct 19, 2005

:eek: :eek: :eek: :eek: :eek: :confused: :confused: :confused:

I am trying to update a database table via a command button on the main form, that uses tabbed sub forms.

The database gets its data from paradox data tables copied our company's
third-party software. These table files are copied from one location to another to stop the paradox database from locking up and giving me errors during the import process of this database. I then link to these files at a pre-determined location on a local computer hard drive.

When I try to run the code below I get the error about the table being
locked by a user or process. As you can see I have tried adding a pause
incase the files are still being copied but this does not seem to be the
problem.

I have used a msg box to confirm that the copying process has completed before starting the make query, but the same error comes up after I click ok.

Can anyone suggest anything else.

As you can see from the simplicity of the code below I am a beginner so take it easy on me, by not taking knowledge for granted. :)

code:
------------------------------------------------------------

Dim response
Dim stDocName As String
Dim stLinkCriteria As String


response = MsgBox("Are you sure that you want to update xxx with Customer
data from xxx?", vbYesNo, "Perform Update")
If response = vbYes Then

‘pause software to let any pending work to be completed
Sleep (5000)

‘close active form
DoCmd.Close

‘close all active forms
Do While Forms.Count > 0
DoCmd.Close acForm, Forms(0).Name
Loop

‘pause software to let any pending work to be completed
Sleep (30000)

‘delete existing file
Kill "c:folderfile DATA.DB"

‘replace with new file
FileCopy "J:Folderew_DATA.DB", " c:folderfile DATA.DB "

‘pause software to let any pending work to be completed
Sleep (40000)

DoCmd.SetWarnings False


stDocName = "Make_DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

stDocName = "Make_DATA_SUMMARY"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

stDocName = "qry_Update_ Status"
DoCmd.OpenQuery stDocName, acNormal, acEdit

‘pause software to let any pending work to be completed
Sleep (35000)

‘open up main form when finsihed
stDocName = "main-form"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.SetWarnings True


Else
End If

View 3 Replies View Related

How Can I Make A Form Always Return To The Form That Called It?

May 16, 2005

I have several forms that can be called from more than one other form, but I need to build my forms so that the user is returned to the form from which they started.

I have looked in the help files and FAQ and I can't find what I am looking for.

Please, can someone direct met to the required information or tell me how to achieve this?

Thanks,
Kev.

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

Error: Member Already Exists In An Object Module From Which This Object Module Derive

Oct 1, 2004

I am creating an form in a database and whenever one of my procedure's run it creates this error message:


The expression ON Load you entered as the event property setting produced the following error:
Member already exists in an object module from which this object module derives.

*The expression may not result in the name of a macro, the name of a user-defined function, or [event Procedure].
*There may have been an error evaluating the function, event, or macro.

An ideas?

View 7 Replies View Related

Can't Get To VB Module In Form

Oct 21, 2005

I am in Acess2000 and trying to go to put vb in. When I hit the code icon,
I get the message: "name of db" failed to create the VB module '|'.

Is anyone familiar with this message and what do I need to do. I just added this form, and in the other forms that have vb code already, I can get to them okay.

Thanks in advance for your help.

View 2 Replies View Related

Modules & VBA :: Button On Form Which Calls Module To Show Calendar Form

Sep 11, 2014

I have a button on a form which calls a module to show a calendar form. The user picks date and time, and saves it. The calendar form closes and adds the date and time to a text box on the initial form.I want to save the record so that the underlying table/query is updated, but it's not working. The record is not saved until the initial form is closed.Here's the form vba...

Code:

Option Compare Database
Option Explicit
Private blnFlag As Boolean, blnSaveIt As Boolean
Private Sub btnDelete_Click()
On Error GoTo Err_btnDelete_Click

[code]...

View 3 Replies View Related

Forms :: Navigation Form - BrowseTo Command To Open Up A Form In Built-in Subform Module

May 3, 2013

I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:

DoCmd.BrowseTo acBrowseToForm, "frmSales","frmNavigation.NavigationSubform", , ,acFormReadOnly

frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?

View 3 Replies View Related

Form's Module Disappeared

Sep 21, 2005

Hi,

My mainform, which controls virtually all operations, has dissappeared.

Since it´s supposed to load when starting the database, the form actually loads, but you can´t see it in the forms window.

when I try to edit the code I get the message "module not found".


What do I do?

Thanks

Fuga.

View 4 Replies View Related

CodeEditor (Form) Can't See The Module's Intellisense

Apr 25, 2007

You know, when I create a new form and add a button to it. Then I add a new module and entered a public Sub in it. Once I switch back to the new form, I typed this below..

Code:Dim sTest as basTest

I noticed there is no "basTest" in the intellisense. Why? I kept getting a compiler error saying "A module is not a valid type". What do I need to do to fix that? I'm at loss on what's the problem is.

Thanks,
FletchSOD

View 1 Replies View Related

Forms :: Navigation Form - Call VBA Module

Nov 4, 2014

I have three forms - Form1,Form2 and Form3 linked to a navigation form with Navigation buttons. I have separate VBA codes under each Before update event of these forms, Form1,Form2 and Form3 to call a VBA module to track the changes performed by the users(Like an Audit Trail) in specified fields of the forms which will track them to a table.there are control tags in the form properties --> others --> Tag to track the changes in the fields which are defined in the VBA Module.this is the code to call the VBA Module:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Call AuditChanges("UniqueID", "Part No", "NEW")
Else
Call AuditChanges("UniqueID", "Part No", "EDIT")
End If
End Sub

[code]....

The code is working perfect when the forms are run separately.but when they are run from the navigation form by clicking the navigation buttons, the code is not working !!

View 2 Replies View Related

Modules & VBA :: Accessing Form Functions From Module

May 22, 2014

I want to put some form functions into a module.here is what I currently have in the module:

Public Sub Fun_Test()
Forms!Form_Output!Sequence.ColumnWidth = 250
End Sub

my form name is "Form_Output" but it still cant find it..

View 1 Replies View Related

Modules & VBA :: Update Form From A Module Function

Jun 16, 2013

I have this code below that is working however the calculation are updating on my form late.

Basically, I have some calculation that are performed on a "After Update" event on some controls on my form. I wanted it to do the calculation after I update the control on the form.

The code is in a module and I just call the function after update on the control But the form is not updating when I change the value in a field. I have to change the field again for it to update.

Control

Code:
Call GeraAuditCalc
DoCmd.RefreshRecord

Function

Code:
Function GeraAuditCalc()
Dim fHrs As Double
Dim Ttl As Double
Dim Ttl1 As Double
Dim Ttl2 As Double

[Code] ....

View 4 Replies View Related

Modules & VBA :: Refer To Form Object Module By Variable

Jan 1, 2014

An instance of a form can be opened with:

Dim frm As Form
Set frm = New Form_formname

How can this be done using a variable as the formname?

View 5 Replies View Related

Modules & VBA :: Module Opening Form With Blank Record?

Sep 10, 2014

I have the following module in my database to allow for multiple alarms.

It all works great, except before showing the actual alarm record called, the form first pops up showing the first record in its record source.

I.e. it flashes up showing the first record in the table, then changes to the 'correct' record.

I would just like to change it so it either doesn't show until the record is loaded, or it shows blank to begin with.

Here's the module...

Code:
Option Compare Database
Option Explicit
Public clnPopUpAlarm As New Collection 'Instances of frmPopUpAlarm

[Code].....

View 2 Replies View Related

Any Limit To Number Of Functions / Subs In Form Module?

Jan 8, 2015

Is there a limit to the number of fucntions/suroutines in a Form's module. I got an overflowerror when compiling and I moved a fucntion from the Forms mdoule to another module and the error did not re-appear.

View 5 Replies View Related

Modules & VBA :: Module To Modify Report Controls Based On Form?

Feb 12, 2015

I am trying to create a customizable report that would allow the users to choose fields. I have a pretty common code that I found online and adapted it, but it fails on the first SetReportControl function.

The error reads: Run-time error 2465: Application-defined or object-defined error

Could it be something as simple as an incorrect reference? I have checked multiple times, but I am stumped.

Code:
Option Compare Database
Option Explicit
Sub MakeReport()

[Code].....

This is a trial run, in the end I need to be able to open a report, then adjust the Report controls within 1 or more subreports inside the main report. That is a battle for another day.

View 14 Replies View Related

What Is This Called?

Mar 2, 2006

I am in a form that someone else created. It has 3 tabs to the form. It is almost like Excel, but the tabs are at the top, as opposed to the bottom. Are they called tabs, pages, or subforms or something else? I can't figure out how to add one to a different form I have created.

View 2 Replies View Related

I Dont Know What I Want Is Called

Feb 6, 2007

What I want to do, is have an unbound form, user enters data in to it, then clicks on a 'save' button which then writes the data to a new record within a table

I have got no idea what it is called so find it hard to do the search.

View 14 Replies View Related

BeforeUpdate Not Called...

Jul 22, 2005

A stupid question here...

I have a form that has a single bound text box that is set to currency. The table is also set as currency with decimal places set at 2. I have my own save button

Now I want to catch if the user types in text instead of numers and display a suitable error message.

When the user presses the save button I call this code:

DoCmd.RunCommand acCmdSaveRecord

heres the before update event

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo errHandle

If Not IsNumeric(hourlyRate) Then

MsgBox "Please enter a number for the hourly rate", vbInformation
hourlyRate.SetFocus
Cancel = True
Else
If (hourlyRate < 0) Then
MsgBox "Please enter a positive hourly rate", vbInformation
hourlyRate.SetFocus
Cancel = True
End If
End If
Exit Sub
errHandle:
MsgBox Err.Description & " " & Err.Number
Resume Next
End Sub

However the update event isnt called and I get an access message saying that the value you entered isnt correct for the field blah blah blah.

Q - How do I stop this access message from being shown???

btw - If I enter in a negative number my message box is shown, and then i get another access message saying that the run command was cancelled.

arghhh - I dont want these :-)

View 4 Replies View Related

What's This Control Called...

Sep 15, 2006

I've got a mental blank, I want one of those things that is a text box with little up and down arrows on the right so you can choose a number. What's it called?

View 9 Replies View Related

Spinners - I Think They're Called That

Jan 5, 2008

In Access 2000, I am using a form with fields for TimeStarted and TimeFinished. After the user has filled in the TimeStarted, the After_Update event sets TimeFinished to one hour after that. I would like to use what I think are called "Spinners" so that the user could simply click on increment or decrement buttons to change the FinishTime.

I'm not sure about the name of the feature, so it is hard to find help to get started. Would appreciate any guidance. Thanks, Andrew Thorpe

View 5 Replies View Related

Functions Running Before They Are Called

Dec 12, 2007

Hi, I have a strange issue. Every now and then, when i start up my database (still in development) it either asks me for a value thats used in a sql command, or faults with an error saying it cant reference a value. The stragne thing is that the values that get pinged are not set until im a few forms into my database, and shouldn't even be thought about by the database yet. Is there something im missing here?

An example,
It asks for a change reference number on login form load, however that value isn't called until a button is pressed on the menu form which loads the change form. That same button sets the change number

View 1 Replies View Related







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