Modules & VBA :: Custom Event Does Not Fire

Jul 8, 2015

Ihave implemented custom events to sync between open forms. I noticed that if the code is engaging in middle of the way referncing a form with form constant (Form_formName) then the listeners stops listening so the event isn't firing, without getting the reason of this i just avoid using it Now, i have a problem that i want to open multiple instances of the same form and i didn't find another way than set frm = new form_formName as this is the only way i seem to be able to reference a closed form, so my question as followes

1. whether the "breaking" issue can be solved without avoiding "Form_FormName"
2. or a way to open

eference a form without using "form_FormName"

View Replies


ADVERTISEMENT

Forms :: Enter / Return Key - Does Not Fire Event

Jul 1, 2015

when pressing the return key (in a textbox field within a form) an action should be fired, but it does not.

here is my code:
************************
Private Sub txmyTextbox_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
MsgBox "Return key pressed"
End If
End Sub
*****************

View 2 Replies View Related

Frame On_Click Event Doesn't Fire On "no Change"

Jan 2, 2006

I have an invoice program that allows users to select a shipping cost option as a toggle in a frame object. When selected "On_Click", the percentage is used to calculate the shipping of the items ordered. Occasionally users will then add additional items, re-click the toggle, but nothing happens. If they click another shipping percentage (there are 3) it calculates. If they click the original percentage now,(essentially CHANGING the frame.value) the calculation occurs fine. It almost seems that the On_Click event toggle in the frame is acting like an On_Change or AfterUpdate.

I have tried the mouse-down event, but this doesn't change the percentage.

I know I could add a separate "Calculate" button after the user makes the shipping selection, but someone is bound to forget to hit it.

Any ideas on how to make the frame On_Click work if the value doesn't change in doing so?

View 9 Replies View Related

Modules & VBA :: How To Force A Combo Box Trigger To Fire

Mar 11, 2014

I have about 4 combo boxes with a list value of dates in them, combo1 is the 'main control'. When a date from combo1 is chosen and a button is clicked, the other 3 combo boxes receive a default value that closely matches combo1. In fact the default value each of the 3 combo boxes receive exists in that combo box. For example, if I gave combo2 default value "2013/01/01", it actually has that date in its list. What I want to do is trigger a OnChange even after combo2,3,4 receive their values. Other things happen after the OnChage trigger is fired.

View 2 Replies View Related

Modules & VBA :: Passing Variable From Excel To Fire Access Query

Dec 17, 2014

I'm running a VBA routine in Excel that loops through a lot of data. As part of the process, I'd like to pass a variable from Excel to an Access database that is open and have it run a query based on that value.

View 4 Replies View Related

Modules & VBA :: Exporting With Custom Name

Jul 16, 2015

I have created 2 reports one that needs to be exported as an excel file and the other report as a PDF file. I have the exports working correctly for each on a button except this saves the files with the name of the report. The client wants the name of the file to appear as one of the fields on the report (the info that is in the description text box for example).

I have thought of two ways to do this and neither seems to be great - one is create a copy of the report with the new name and then export that saved file then delete the renamed report OR similar to that but instead rename the file save and rename it back (this causes all kinds of problems if the user cancels out that would need to be handled in the error handling - this is not a good way to go.

View 8 Replies View Related

Modules & VBA :: Argument In Custom Function

Jun 6, 2014

I'm having a problem with argument in custom function..My table is like this:

myValues
123.5
32.7
65.8
11.1

What I want to achieve is to multiply each value with the average of all values, so that at the end I get (avg(myValues) = 233.1):

myValues2
7196.963
1905.593
3834.495
646.8525

For this I would like to have a function (this is simplified example of bigger problem, that is why I need function, otherwise simple SQL would suffice as mentioned below also), so that I could do something like this:

'SELECT TestFn([myValues]) as myValues2 From MyTable' or
'SELECT TestFn("[myValues]") as myValues2 From MyTable'

and I should get the table above.

My code is like this

Code:

Public Function TestFn (FieldName) as String
Dim myAvg as Double
myAvg = Davg(FieldName, "myTable")
TestFn = FieldName * myAvg
End Function

I understand the problem is that Davg needs string, but if I change to string then the multiplication does not work. The 'FieldName' parameter does not have a Type specified because that is where the problem is if I give string Avg works ,but calculation does not. If I give Number, avg does not work.

P.S. "as String" at the end of function is not a mistake, I need number as a string

P.P.S I did not inculde NZ either as in my example it can never be Null.

View 8 Replies View Related

Modules & VBA :: Creating A Custom Shortcut Menu

Jun 5, 2014

I'm working to put together a shortcut menu for a form that will be viewed as a datasheet. I'm trying to put together the vba to create the menu. I'd like a lot of the standard options i.e. sort a-z, filter toggle etc. I'd also like to add the menu option that is displayed in the default menu called "Text Filters". I've been unable to find the id code for that option, and since it, when chosen opens another menu, I'm not real sure how to code it. Here is what I have so far:

Sub CreateWIPShortcutMenu()
Dim cmbRightClick As Office.CommandBar
Dim cmbControl As Office.CommandBarControl
' Create the shortcut menu.
Set cmbRightClick = CommandBars.Add("cmdWIP", msoBarPopup, False, True)

[code]....

View 2 Replies View Related

Modules & VBA :: How To Build A Custom Record Delete

Sep 24, 2013

I'd like to override the default behaviour for deleting records in a form.Specifically, I want to build my own custom delete procedure so that when the user presses the Del button, my code fires to complete the deletion of the selected record(s). In order to do that, I'd set Allow Deletions = No for that form. I'd also want to code the KeyDown event for the Del key so that if record(s) are selected, my custom delete code fires, else the default behavior for the Del key happens.I'm primarily interested in how I might code the KeyDown event.

View 12 Replies View Related

Modules & VBA :: Custom Record Counter Of A Form?

Jan 27, 2015

I have a custom record counter on a form using the below code:

Private Sub Form_Current()
If Me.NewRecord Then
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount + 1
Else
Me.lblRecordCounter.Caption = _
"Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
End If
End Sub

I think at some stage the form was saved with a filter on and this may be causing the issue. The problem I have is:

There are 1749 records. Everytime I open the form the custom record counter displays "Record 1 of 501". The built in record counter shows 1 of 1749. The moment I hit the next record arrow the custom record counter displays "2 of 1749" and if I go back again it displays "1 of 1749.".

I know it's a filter causing the problem because I have a macro that does a clear search. As soon as I hit the clear search the custom counter goes back to "1 of 501" again (even though the built in one stays at 1 of 1749).

I have Filter on Load set to No.

what I am doing wrong?

View 13 Replies View Related

Modules & VBA :: DCount With Custom Fiscal Year

Jan 21, 2014

I have having an issue with determining how to use a customized fiscal year with a DCount function.

My Code:

ThisYear: DCount("*","Open Issues","year([RequestDate]) = " & Year(DateAdd("y",-1,Date())))

The code only does from Jan 1, YYYY TO Dec 31, YYYY

I'd like the code to read from Oct 1, YYYY TO Sept 30, YYYY

View 2 Replies View Related

Modules & VBA :: Delete A Record With Custom CMD Button

Jul 12, 2015

I am building a db for reservations for my limo company. I want to have a cmd button that verifies the user to make sure she wants to delete a run. This is what I have so far:

Private Sub cmdDeleteRun_Click()
Dim Response
Response = msgbox("Are you sure you want to delete this run?", vbYesNoCancel + vbCritical, "Really delete run?")
If Response = vbYes Then

End Sub

I don't know what I am missing for the cmd to actually delete it.

View 3 Replies View Related

Modules & VBA :: Custom Record Navigation Buttons

Jul 11, 2014

To briefly explain my database; it is a bespoke referral management system within a hospital. Each record on the database contains patient demographic information, as well as information on their referral (i.e. date of referral, date of assessment, date of commencing treatment, discharge date etc.) Therefore, the same patient will appear multiple times in the database, with each separate record corresponding to a unique referral pathway.

The database forms are split to show patient information at the top, with referral information shown in a subform. I am trying to add navigation buttons to the subform that will allow the user to scroll through the referrals corresponding to the patient currently displayed on the main form.

Each patient has a uniquely identifiable number associated with them, and so it seems straightforward enough in my mind to have a button that will search for the record in the database where the patient's number matches the patient number of the current record, and where the referral date is minimum (for "First Referral"), maximum but less than current (for "Previous Referral"), minimum but greater than current (for "Next Referral"), and maximum (for "Last Referral").

View 5 Replies View Related

Modules & VBA :: Creating And Initializing Custom Class / Object

Jun 13, 2013

I've been playing around with creating my own class in VBA but I'm having problems calling its methods. My class is pretty basic, its called cDentist and the properties are just Name, Address, DOB etc and one method AddDentist. AddDentist will add the details to a sql server table.

So I create an instance of the class in a module called Dentist. At the very top of the code i put..

Code:
Option Compare Database
Global Dentist As cDentist

I have a method then in module Dentist, where I initialise the instance of class cDentist and i populate it's properities...

Code:
Sub RecordDentistDetails()
Set Dentist = New cDentist
Dentist.Name = Forms!frm_enterdetails!txtName

[Code].....

When I click 'Save' I get error, Method or data member not found. And '.AddDentist' is highlighted. I'm a little confused why it's not seeing AddDentist as a method of class cDentist.

View 14 Replies View Related

Modules & VBA :: Monthly Reports Starting By Custom Month

Sep 9, 2013

I'm creating an accounts package..I've used access chart wizard to create a chart that shows total gross income per month.This displays correctly but the months start at January and end in December. It would be more useful if the months could start and end for the financial year. The syntax generated by access for the current implementation is:

Code:
SELECT (Format([DatePaid],"MMM 'YY")),Sum([TotalPaid]) AS [SumOfTotalPaid] FROM [Q_AllCust_Gross] GROUP BY (Year([DatePaid])*12 + Month([DatePaid])-1),(Format([DatePaid],"MMM 'YY"));

How do I edit this to make say September my start date?

View 2 Replies View Related

Modules & VBA :: Custom Menu Bar Won't Display In Access 2013

Apr 5, 2014

I have a program.mdb with a customized menu bar from Database Creations.When I open program.mdb in 2007 & 2010 the ribbon is disabled and the custom bar is displayed as it should be and all is OK.When I open the same program.mdb in 2013 the ribbon is displayed and the custom bar is missing

I have a clean compile and get no error messages.How do I disable the ribbon and get the custom EZ Menu Bar to display in 2013?.Following are the Options, Current Database, Ribbon and Tool Bar Option settings that is used in all Access 2007, 2010 & 2013 versions

Ribbon Name:
Menu Bar:EZ Menu Bar
Shortcut Menu Bar:(default)
CheckedAllow Full Menus
CheckedAllow Default Shortcut Menus
UncheckedAllow Built-in Toolbars

View 1 Replies View Related

Modules & VBA :: Datasheet View Custom Fields Duplication

Mar 2, 2015

I have a database with a large number of records: ~2000, so I use a form in datasheet view to filter and sort the records to find a particular one.

This works fine for locating a certain record.

Sometimes I then need to make a new record but I will be duplicating a few fields from the one I just found.

At the moment I manually do this by copying each field I want into word and then pasting as appropriate into fields in the new record.

Is there anyway I can still use datasheet view to search for a record, then select certain fields and have them duplicated into a new record?

I should add that the datasheet view is locked for editing, I have a separate form in single form view for entering a new record. Sort of vital information i missed out there.

View 4 Replies View Related

Modules & VBA :: Custom Tool Bar / Menu Handling In 2010?

Jun 23, 2014

I know that ever since 2007 custom menus are not well supported as in 2003. From what I've read, outside to using 2003 to make changes, a person can create/update the menus using Commandbars in VBA.

Some coding to use Commandbars to create/update menus/toolbars for Access 2007/2010? It seems possible to do that, although I would expect it would be a lot of work. I've seen a few one-off examples to do specific updates, but so far nothing that would approach what was available in 2003.

View 3 Replies View Related

Modules & VBA :: Using A Custom Aggregate Function With GROUP BY Clause

Dec 20, 2013

I am trying to calculate annual percentiles of a large set of data and I have only been successful at retrieving the percentile of the entire data set (and not by the grouping). See provided example database for code/query. Query1 is what I want to happen to make the Percentiles table.

View 14 Replies View Related

Modules & VBA :: DLookup In Custom Function Not Returning Values

Sep 13, 2013

I made a custom function to look certain value from table based on couple of criteria that it gets from query where I want to use it. Function's code is below:

Code:
Public Function PotteryWeights(strLocusID As Long, nrPotSubID As Long) As Variant
Dim priSubID As Long
Dim priLocusID As Long
Dim priResult As Variant
priSubID = nrPotSubID

[Code] ...

However, when I use it in query it only returns Case else - option and everything else is empty.

View 7 Replies View Related

Modules & VBA :: Make Table - Assign Custom Formatting To Numbers

Oct 6, 2014

I am using VBA to execute a 'Make Table' (named 'DT'). One of the fields in DT (named 'Dollars') contains numbers that have 6 to 8 digits; some are positive and some are negative.

These large numbers with no commas (or parentheses when they're negative) are incredibly hard to read.

Any VBA coding that will change both the "Format" and the "Decimal Place" Field Properties on the table I make (i.e. "DT"). I want to the Format property to read (#,##0.00;(#,##0.00)) and the Decimal Place property to read "2"). This will allow me to display a number like -10326786.41 as (10,326,786.41) which is incredibly more readable.

Is it possible to do this programmatically; I've search the internet high and low and could find anything remotely useful.

View 8 Replies View Related

Modules & VBA :: Creating Custom CommandBarControl Objects For A Shortcut Menu?

Aug 16, 2013

I finally got tired of having 100 macros managing my different custom shortcut menus, and decided to figure out how to generate the shortcut menus programatically (because lets be honest, Macros are the devil.)

I found a good tutorial here : [URL] .....

and was able to create some basic shortcut menus like the following:

Code:
Sub CreateCopyShortcutMenu()
Dim cmbshortcutmenu As Office.CommandBar
Set cmbshortcutmenu = CommandBars.Add("CopyShortcutMenu", _
msoBarPopup, False, False)
'ID 19 adds copy command
cmbshortcutmenu.Controls.Add Type:=msoControlButton, Id:=19
End Sub

Nice and simple, now I have a copy command. But the problem is that I also need some custom commands. Most (possibly all?) of these would be function calls.

View 3 Replies View Related

Modules & VBA :: Function To Get Fractions From Double - Error 91 With Custom Class

Jun 10, 2014

I haven't created classes in a while, and I don't see what is the problem

I'm modifying a function to get fractions from double. It worked well, but it returned a string.

I need it to be in parts, so I created this class

Code:
Option Compare Database
Public Entier As Integer
Public nominateur As Integer
Public denominateur As Integer
Public Function getText()
getText = Entier & " " & nominateur & "/" & denominateur
End Function

I changed the function type and the assignation:

Code:
Function GetFraction(ByVal Num As Double) As nombreEnFraction
Set GetFraction = New nombreEnFraction
If Num = 0# Then
GetFraction = "None"
Else
Dim WholeNumber As Integer
Dim DecimalNumber As Double

[Code] ....

For some reasons, when I get to the end of the function, I get a 91 error, like if it was nothing

But when I use a spy, I see values in the object until the end.

View 1 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 :: Machinery Database To Match Parts Up With Equipment - How To Do Custom Sorts

May 24, 2014

I am creating a Machinery database to match parts up with equipment. So they can see what the Equipment is and all the available parts. The sort needs to be like this

First Sort:

If the manufacturer of the machine is the same as the manufacturer of the part sort that at top then sort alphabetical

Is this possible? Each equipment would have a different manufacturer so I can not do some type of hard coding.

View 1 Replies View Related

Modules & VBA :: Custom Function Module - Find Records With Specific Keywords

Feb 28, 2014

I'm looking for some type of custom function that will search a specified column for any keywords listed inside another table.

I can run a query on each keyword individually, however there are 50 and it takes a long time each time I do it. I was hoping to write in a function for that column and it would just select all records that match.

These would all need to be a "like" with an " * " on each end of the word.

With SQL it would look something like:

Code:
select a.address1
from main_tbl as a
where a.address1 like '* north *'
or a.address1 like '* park *'
or a.address1 like '* south *';

I just want it to read each of the table values instead of hard coding them and the column name would be the function name so it can be used in any column I specify. I'm just not sure how to incorporate this into a custom function.

View 2 Replies View Related







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