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 Replies


ADVERTISEMENT

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

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 :: 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 :: 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 :: 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 :: Click Event To Open A Form And Select Record Corresponding To Value In Unbound Text Box

Oct 29, 2013

I have some code for a button on click event to open a form and select the record which corresponds to a value in an unbound text box. The code is:

Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOpenPatientRecord"

[Code] ....

This works fine when I put in a 10 digit NHS number but opens a blank record when I enter a four digit or six character/digit PatientNumber. Both patient number and NHS number are text fields in the underlying table.

View 14 Replies View Related

Modules & VBA :: Print Preview Button On Main Form That Previews Current Record In A Separate Report

Jan 25, 2014

I have VBA code for a Print Preview button on the main form that previews the current record in a separate Report using this code:

Code:
Private Sub cmdPrintRecord_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

[code]....

I use this Print Preview code on a Button in the Form Header. The Main form lists head of household information. I also have a tabbed control with three tabs that have SubForms for Address, Children and Contact details. The problem I have is that if any of the subforms are left blank I get a Run-Time Error '3021': No Current Record. If I Debug (press the button), it takes me straight to this line:

Code:
varAge = DateDiff("yyyy", varBirthDate, Now)

highlighted in Yellow.Anyone on my database must have an address, should have contact details and could have children. If any one of these is blank then the print preview will not work.I would like to know how to stop this error happening for blank records in my subforms.

View 11 Replies View Related

Modules & VBA :: Event Information - Deleting Record Creates A Blank Record

Sep 8, 2013

I have a form set to the table Client Information with a subform set to the table Event Information. Client Information has a one to many relationship to Event Information.

There is a button that deletes the current record in Client Information--also deleting the related records in Event Information--then closes the form. The code works fine but a blank record in Event Information is apparently being created before the form closes.

Here's the VBA that I'm using:

Private Sub CmdDelReturn_Click()
Dim CmdDelReturnMsg As String
CmdDelReturnMsg = MsgBox("Delete event & client then return to front?", vbYesNo + vbDefaultButton1, "Delete and Return?")

[Code] ....

It's not a big deal because the button won't be used often and I can manually go into the table to delete the blank record. But if there's a simple solution to prevent this that would be nice.

View 3 Replies View Related

Modules & VBA :: Linking Tables By Auto Inserting A Record Using Current Record

Aug 19, 2013

I have two forms both with separate tables

(1) Register and
(2) Payments.

One of the common denominators between them is the URN which is auto-populated as it is an auto number field. My issue is that when I want to add a new record to the payments table using the forms (I can get to the payments form via the register form), I want to be able to identify the record that I am currently viewing within the register and auto populate the URN field with the same number. This is what I have done so far,

Option Compare Database
Option Explicit
Private Sub AttachPaymentDetails()
Call PerformInsert("tblFinancialBudget", "frmFinancialBudget")
End Sub

[code]....

View 5 Replies View Related

Modules & VBA :: Display Last Record Next To Empty Space On Current Record

May 6, 2015

I'm trying to make a form that shows what the last record was next to the empty space where you enter a new record.

This is so the user knows that what they are entering is roughly in line with what has come before.

So for example if I was recording temperature every May, I would like a form that has a field called temperature and next to that field I would like to see last year's temperature.

Records:

Date | Temp
2014 | 20.5
2013 | 18.5
2012 | 19.0
2011 | 22.7
2010 | 15.2

So when I enter the record for 2015 I have a box that says: Temp and next to that box is "Last year was 20.5" or something like that.

View 2 Replies View Related

Forms :: Double Click Event - Form Showing 1st Record Instead Of Selected Record

May 8, 2014

I am new to access and I recently encountered a double click issue

My form loads perfectly on double click event but it shows the first record instead of selected record.

My search is based on a PersonID but each PersonID has different WorkID that I wish to display on double click but it always shows the first WorkID instead of my selected record

I have tried changing the filters in the form properties but it still doesn't work for me.

Here's my code:

Private Sub SearchResults_DblClick(Cancel As Integer)
DoCmd.OpenForm "WorkForm", , , "[PersonID]=" & Me.[Searchresults], , acNormal
End Sub

[Searchresults] draws information from my Query

Query information:

PersonID... WorkID... Type......Location
1234..........1............Paint .....Address A
1234..........2............Electric...Address B
1234..........3............Floor..... Address C

View 7 Replies View Related

Modules & VBA :: How To Bypass Before Update Event When Record Is Deleted

Sep 21, 2014

I have a database which is slowly evolving. Users needed a feature to delete some records without a trail and some with a trail from the form. So I added an apply action field in the subform using which they can delete a record without a trail and if they wanted to keep a trail they could do that too. When user selects "Delete Violations as it was entered in error" the system deletes the record completely which is what everyone wanted.

After six months of use now I am asked to add an audit trail. I managed to do that also. I also looked at Browne's method but my data structure does not match the requirements for that method. I used an alternate method. It works as intended except when a record is completely deleted using the code I mentioned above. Then it goes in the infinite loop. I somehow need to bypass the before update event so that the function to write the audit trail is not called.

I have attached the database ...

View 14 Replies View Related

Modules & VBA :: Event That Trigger On Selecting A Record Of Subform

Jun 30, 2014

I've got a subform that im writing code for, once a user enters a value in one of the fields i want to make sure they cant change that field (and two other fields in that same record, though the rest of the fields are fine to edit at will)

I've got a function already written to validate the data in the record and decide whether or not the fields are enabled and disabled, however im having trouble finding an event in which to activate the function

Is there an event that triggers whenever a user selects a different record?

Any chart or list with all the handlers and how they trigger (in relation to each other) and when?

View 1 Replies View Related

Modules & VBA :: Can Simulate A New Record Table-level Event?

Jun 12, 2013

I have a list box that displays the contents of a back-end table that is has a new record added roughly 45 times per hour. I'd like the listbox to refresh automatically when a new record is added and, ultimately, notify the user that the new record is there. Are there any non-form events I can use to accomplish this? Right now, my workaround is to refresh the box once a minute using the form's timer. It works fine, but it's not pretty. Ideally, I could create some sort of event based on the new record being saved in the table.

View 6 Replies View Related

Modules & VBA :: List Box Current Record

Jun 18, 2014

I have a list box that my client goes through with vbKeyDown and vbKeyUp. When he finds the correct record he wants to do vbKeyReturn and capture the checktype code and description and have them placed in a check which is another form that is open. The following code does not work:

Private Sub List3_KeyDown(KeyCode as integer, Shift as Integer)
If KeyCode = vbKeyReturn Then
Forms!frmChecks![TRA{CODING =
Me.CurrentRecord.Column(1)
Forms!frmChecks![TRA:CODEDESC] =
Me.CurrentRecord.column(2)
DoCmd.Close adForm, "frmCheckType", acSaveNo
KeyCode = 0
End If

View 2 Replies View Related

Modules & VBA :: Copy Current Record From Recordset To Csv

Aug 4, 2013

I have a DAO.recordset called "rsSQLIn". This comes from a csv file by:

Code:
strSql = "SELECT * " _
& "FROM [Text;Database=" _
& strFolder _

[Code]....

While the validation runs a boolean keeps track of validated input and errored input.

After validation the validated input is dumped in the table.

Now what I want is de saving the errored record from "rsSQLIn" to be copied to a new .csv file.

The problem I have is that I cant seem to get the current record from the recordset "rsSQLIn". How do I reference this? I need the complete set of 24 fields being the same within "rsSQLIn"

View 3 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 :: Export All Attachments In Current Record

Nov 5, 2013

i want to crate a continuous form where i can add a button to export all of the attachments in that current record, i can create a folder and name it same as the selected record but how I can export all of the attachments in that record

Code:
Dim strUserName As String
Dim Location As String
strUserName = Environ("UserName")
Location = "C:Documents and Settings" & strUserName & "Desktop" & Me.ID
If Dir(Location, vbDirectory) = "" Then
MkDir Location

View 2 Replies View Related

Modules & VBA :: Print Current Record From Recordset?

Aug 7, 2015

Is there a way to print the current record from a dao.recordset?

This is an exercise to compare data content.

I have a table with 30 fields and thousands of rows (rs1).

I'm comparing it with a copy of the same table (rs2) that has the same number of fields and the same rows and almost the same content.

I can loop through the recordsets and get the cursor to stop on a field whose values don't match, lets say on row #x

and the programmed message will say something like:

"ROW: 699 Field: [RequestStatus] rs1.VALUE: Closed, DOES NOT MATCH rs2.Value: VOID, in the comparison recordset"Then I'd like to print the entire Row, Row #699.

I thought I could use rs1.getrows but I'm not sure how to make that work.

View 4 Replies View Related

Modules & VBA :: No Current Record - Unknown Source

Sep 11, 2013

I am receiving the No Current Record message, but have been unable to determine the code that generates it. The database is a system that creates tasks and assigns them to users. In the header section of the Tasks form are several controls they can use to select Active or Completed tasks, refresh the data, sort by columns, etc. There are also three other forms (not subforms) that lay on top of the Tasks form to provide additional detail about the current task.

If they "complete" all their active tasks and click Refresh, all the tasks disappear, as they should, and everything works fine. If they then try to close the form, or click any control in the Tasks header, the No Current Record message pops up. I've put debug stops in every conceivable location, but the message appears to occur before any code is activated.

I did find that I can make the message not occur by commenting out the code that synchronizes one of the associated forms (Notes), but I still don't know what is triggering the message. Debug stops in Notes yield no results either, and clicking a control in the header of Tasks shouldn't affect Notes.

How to find out what's triggering the message?

View 5 Replies View Related

Modules & VBA :: Copy And Paste Current Record Only To Excel

Jul 13, 2014

Its been a few years since I used Access, and despite searches I cant find what I'm looking for. I have a VERY simple form, with only one record on it - "address". I have some print buttons which will print that address to different size labels, and some navigation items, but only one actual record - which is "address" (in the table, this address is a MEMO)

I would like to have a command button that when clicked copies the current record, and opens an existing Excel Spreadsheet and pastes that address into (for example) cell C8

Can it be done easily? Is there a DoCmd.TransferSpreadsheet kind of secnario that works with current record only?

View 8 Replies View Related

Modules & VBA :: Show Related Record For Current User

May 11, 2014

I was creating a program using ms access. consist of 2 table of database called employee and userlevel.. in employee table have ID, name, username, password,userlevel, and others related employee profile.. and in userlevel table, it consist of admin level and normal user level.. Userlevel table allow to differenciate admin and normal user(employee) .. in my program each employee having their own loginID and pass to access their own data.. the problem with my program now is displaying the data that belong to the logged in employee. its mean that it only show the data that owned by currently user that logged in..

View 7 Replies View Related

Modules & VBA :: Mailmerge Current Record And Save As New Document

May 25, 2014

I'm looking to add a button to my Customers form which will mailmerge the current record to a Word template and then save the Word doc as a new file (Ideally the customer's name).

I've looked at the Super Easy Mailmerge but I can't work out how to implement it without all of the variables (selecting documents etc.).

The files will all be saved to one location (C:CustomersExports) and this won't change.

This is also the location of the mailmerge template (C:CustomersExportsTemplate.docx)

View 9 Replies View Related

Modules & VBA :: Subtracting Value On Current Record From The Value Of Previous Records?

Jun 5, 2013

I want subtrack a value on the current record from the previous record and display the result in text box in subform datasheet. This is done during data entry. The calculation works most of the time and randomly it returns the wrong value. I have the code in an after update event after I enter a number. Here is what my code looks like:

sysHopSpacing = Abs([sysHop1] - DLookup("[sysHop1]", "tblSystemConfiguration", "[sysBaseNumber]=Forms![frmTempestCoordination]![frmSubSystem]![sysBaseNumber] - 1 "))

This is how I generate the sysBaseNumber

sysBaseNumber = Nz(DMax("sysBaseNumber", "tblSystemConfiguration", "sysAccountID=" & Forms!frmTempestCoordination!accAccountID), 0) + 1

I am using DMax so I can keep the subform records with the parent form record.

My results are inconsistant:

This is what I want the subform to do when subtracking from the previous record

syshop1 sysHopSpacing
5
20 15
30 10

Instead I get a result that does not make sense like this:

sysHop1 sysHopSpacing
5
20 15
30 4

I cant trace it down.

View 14 Replies View Related

Modules & VBA :: How To Send Attachment From Current Open Record

Nov 18, 2013

What I'm try to do is attach any files from the attachment field from the current open record to email i have some code i have manage to get files from the open record to save to destination /temp folder to work so outlook can attach the files but outlook is not opening or putting them in to email also have problem's that i have highlighted in the code in red.

Code:
Private Sub cmdEmail2_Click()
Dim outlookApp As Outlook.Application
Dim outlookNamespace As NameSpace
Dim objMailItem As MailItem
Dim objFolder As MAPIFolder
Dim strAttachementPath As String

[Code] .....

View 1 Replies View Related







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