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 Replies


ADVERTISEMENT

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 :: 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 :: 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 12 Replies View Related

Modules & VBA :: How To Access Description Inside Form Error Event

Jul 31, 2013

I'm trying to extract information from Err.Description within a form's Error event. Alas, Err.Description does not seem to be available from there.I have a form that normally displays in DataSheet view. If a trigger on the Oracle back-end raises an error, I want my Access app to be able to parse out Err.Description and deliver a more user-friendly message than ODBC's message. I want to get the info about the message from the error coming back from Oracle, not by matching up error codes.

If I change the form to Single-Form view and put a Save button on it, I can capture Err.Description in the command button's Clicked() event, and then parse out what I need.So if I must display this form in Datasheet view, where can I trap the ODBC error and display my user-friendly message?

View 5 Replies View Related

Modules & VBA :: No Current Record (3021) Error

Sep 18, 2014

I get this error when I delete more than one record consecutively.

Here is my delete code;

Private Sub Komut98_Click()
Dim blnLast As Boolean
'MsgBox call must return the value in order to be checked.
'If user says no then cancelling is not required. It is only required
' that the deletion command is not invoked.

[Code] ....

View 5 Replies View Related

Modules & VBA :: Double Click Event In Listbox - Run Time Error 3464

Mar 14, 2014

On double click event in the listbox, code as below:

Code:
Private Sub ListBox_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmTransactions"

stLinkCriteria = "[BinNumber] =" & Me![ListBox]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

When I double click any row then it show Run time error 3464.

View 3 Replies View Related

General :: Bound Form - Error No Current Record On Save

May 10, 2014

I have been working on a bound form that I can't seem to get working.

It records deliveries and what I am trying to achieve is after the form has been filled in the user will click a save button where the record will be added to the table and a record automatically printed via a report and emailed to the shop manager, but i keep getting the error "No Current record" no matter what way I try to do it, I have tried using to run the report. Is the best way for me to accomplish this o change it to an unbound for and run an insert query on click?

I have attached a copy of what I have been working on : DatabaseDelivery.accdb

View 2 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

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 :: 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 :: Birthday Remainder On Access Form Load Event

Apr 26, 2015

I would like to have a birthday remainder on access form load event VBA...

I have tblEmp with 2 fields,

Name DOB
A 22/04/1977
B 25/03/1965
C 17/08/1985

I would like to compare Date and month with my system date to show in the message box "Mr. A Birthday Today" on the Form load event...

View 12 Replies View Related

Modules & VBA :: Use Text Box Change Event To Determine Form Format

Sep 23, 2013

Had a combobox so the user could choose between two data entry formats.They don't want the combobox, they want the user to enter data into one or the other textbox - and that choice to trigger the format.Two groups of text box - group 1 has a single text box - group 2 has three text box. When the user selects a text box and types the first character into it. This triggers locking out the other group choice and enables the <Validate and Edit> command button.

If the user backs out (deletes) the text in a text box.It basically makes both groups available again and it disables the <Validate and Edit> command button.Basically, if the text box Change event counts a character, it changes the text box Tag to "Bust". Then it calls a common routine that checks both text boxes.The choice won't take place if the textbox gets focus. It changes if a text box has 1 or more character typed in.

Code:
Sub WhosOnFirst()
' two groups of Required field - if one textbox in a group has a character entered first
' that group becomes the Format - enables the <Validate and Accept> button that will take the next setp

[code]...

View 2 Replies View Related

Modules & VBA :: Subform Event To Update Automatically A Field In Form

Mar 18, 2015

I have a form and a subform

Which method should I use if I need to update automaticaly a field in form based on an event in subform ?

Just to be more clear, have a look in the below example.

In first print screen, student "Johnson Nick" has not completed all tests in TestA subform, the form field "DateCompleteA" is blanc.

Once a student completes all tests in Period A, I need the form field DateCompleteA to show the date that he completed the last one. (18/3/2015).

If student has not yet completed all tests in TestA subform the Form field DateCompleteA must be blanc.

Student has not completed "literature"yet, DateCompletA field is blanc

Student completed ALL his test, subform is updated, Form field DateCompletA is updated with the maximum date.

View 3 Replies View Related

Modules & VBA :: Save Current Form Record Only As PDF

Jan 17, 2014

I'm using: DoCmd.OutputTo acOutputForm, "Frm_EL_PL_Bulk_Send", acFormatPDF, outputFileName1...To save a form as a PDF. The issue is, it saves all the records in that set in continuous form, and I'm trying to get it to only save the record its on.

View 3 Replies View Related

Modules & VBA :: Copy Value From Current Form To A Table

Aug 27, 2013

I have a projects Database with: Projects_Table, Staff_Table.

Both tables has forms for data entry or update. Each project has many staff allocated to it.

In the Staff_Form I placed the Project_Code in the form heading section. The form opens based on a search criterion on the project_code so it shows the staff for that project only. The issue is when I try to add a new staff for that project on the Staff_Form, the project_code stays blank in the staff_table.

What I need is that the project_code in the staff_table for that newly added person to have the same project_code on the opened form. Simply to link the staff to the project they work in when I add them using the form.

View 1 Replies View Related

Modules & VBA :: Main Form Load Event Firing On Application Quit?

Aug 6, 2013

I'm developing in Access 2007 and created a runtime version.

When the user clicks the X to close the runtime application, the main form's Load event fires. Any clues as to why this might be? Some of the code is based on other forms that do close, so of course errors start flying. Note, this is only in the runtime version; the accdb file works just fine.

My current workaround is to put the offending code into the forms On Current event, which I'm able to do in this context.

Is it wrong to think that a forms On_Load event shouldn't be firing when the application is closing?

View 1 Replies View Related

Modules & VBA :: Main Form On Open Event To Show Tabbed Controls Only If There Is Data

Jul 24, 2013

I have a report that tracks scores for our employees. From the report, you can click a button to add a new score in a form or edit an existing score(frmscoretracker). On this form there are two subforms, in a tabbed control to track additional information about the score; what areas were marked down(Trends), and was it a failing score(AutoFail).

When this form opens I have it programmed to only show the subform if there is data in it. The goal being, if I am adding a new score and there is no existing trends or Autofails for this new record, neither subforms will show - I will add an after update even to show either trends or autofail depending on the score recorded. Also, if someone chooses to edit the score, whatever subform with data, will show as well.

When someone clicks to add a new score, opening this main form to a new record, both of the tabs show. However, if the form opens to an existing record, the appropriate tab shows. Here is the code

Code:

Private Sub Form_Open(Cancel As Integer)
'If the subform has a record, the tab is visible, if not, the tab is not visible
If Me.frmtrends.Form.Recordset.RecordCount > 0 Or IsNull(Me.Trends) Then
Me.Trends.Visible = True
Me.TabCtl33.Visible = True
Else
Me.Trends.Visible = False
End If

[code]...

Both tabs are set as not visible in the default settings. Is there something in this code that is triggering then to be visible when there is no record in the main form?

View 4 Replies View Related







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