Modules & VBA :: Log Form Field Changes

Sep 1, 2013

I have access tool with front end and back end parts.My user works with forms in order to add new records or edit records.I wish to "catch" the following events - if the user modify field's value (which is not NULL) I wish to display a notification message and update a comment field / log table with old field data, new field data, time and user name. If the user update field's value from NULL to other value I do not need to log it.

Can I do it in the form level and not for each field ?I wish to discover the modified fields names and analyze their values before and after the update.

View Replies


ADVERTISEMENT

Modules & VBA :: Updating A Field In A Form Based On Another Table Field

Sep 13, 2013

Using Access 2010. Fairly new to automation and macros.I have two tables (tblProductReceived and tblBins) and a form (frmProductReceived).A field in tblBins corresponds to a location the bin is at (named BinLocationID) and the tblProductReceived table tracks product that a specific bin has received.

What I need is for the tblProductReceived field PRLocationID ([tblProductReceived].[PRLocationID]) to be automatically populated with where the bin is at ([tblBins].[BinLocationID]) when selecting a specific bin in the form (frmProductReceived).

View 1 Replies View Related

Modules & VBA :: Unbound Form - Selecting Label OnClick Does Not Recognize Changed Form Field?

Feb 5, 2015

Access 2007
Unbound Form

I have a onclick tied to a label (for decoration purposes) that when clicked it launches VBA that essentially updates a form. All that part works except it will not recognize any changed value of the field I was last in?

Just to try to explain best as I can what happens.

- Form gets opened
- I change field (quantity field)
- I click the Label
- It reverts to pre-existing value.

if I click off of the text field first then do the onclick - it recognizes just fine.

View 7 Replies View Related

Modules & VBA :: Reference Field On Form

Apr 21, 2015

I had this line :

GBL_Tab05ID = Me.Tab05ID

and wanted to change this. I have this on the On Current event and it gives me an error because the data is not in the record source when the form opens. How can I change the me. to the formname? The form gets dynamically created so i have

Dim CurrentForm As String
CurrentForm = Me.Form.Name

then i put

GBL_Tab05ID = Forms(CurrentForm).Form.Tab05ID

but that did not work...what is the correct syntax?

View 5 Replies View Related

Modules & VBA :: Save Value Of Field And Use It Once Form Closed

Apr 22, 2015

I have a MainForm. Using a button on the MainForm i open an PopUp form which I enter values.

I want to save the value of a field (text), close the PopUp form. Then use the Saved value in the MainForm to find a record.

So far I have this but not working:

Code:
TempVars.Add "company", Me.CompanyName.Value
If Me.Dirty = True Then
Me.Undo
End If
DoCmd.Close
DoCmd.OpenForm "MainForm"
DoCmd.Requery
DoCmd.FindRecord Forms![MainForm]![CompanyName] = TempVars("company")
DoCmd.GoToControl "Combo48"

View 5 Replies View Related

Modules & VBA :: How To Increment Field On A Continuous Form

Mar 31, 2014

I have a form that is being used for sample submission. Ideally, the user will be able to put in some information (3 or 4 fields) and the number of samples that they're taking, click the arrow and it will insert that number of samples into a temporary table that is then displayed on a continuous form. From there, they can edit samples, add more samples, and generate a report to submit to the genotyping group. Once their sample list is final, I will append it to the master list and clear the temporary table.

I've got the basics working. A looped "INSERT INTO" using a counter inserts the relevant information. I cannot, however, seem to get the numbering field to work.

Ultimately, the numbers need to look something like MySample-001, where MySample would be one of the other fields. Incrementing the 001 is the problem. In another situation in the database, I can successfully use DMax+1 to assign a single number on a single form, but I can't get it to increment the sample numbers.

Ideally, I'd like it to happen when the form is generated. However, I'm also open to having them assigned when the sample list is finalized, before inserting into master table.

View 8 Replies View Related

Modules & VBA :: Move Field On Tabbed Form

Sep 11, 2014

If I have a field in a tabbed form (the form has pages), can this field be moved from a tab to another programatically?

The form is called "ProjectMain". The field is called "Lenght" and the page (form tab) it is on is "specs1". Sometimes I need to have this field in the page (form tab) "specs2"

View 3 Replies View Related

Modules & VBA :: Subform DS Click Field To Open Tab On Another Form

Apr 19, 2015

How do I reference a subform DS field to open up a tabbed form on another subform.

Here's what I have.

field one on the Sub DS opens up tab one on another form, as does field two on DS open tab two on another form.

but..

how can I click on "any" field on the DS, run an IF statement, and it checks if that record on the Datasheet, contains information in regards to, IF field one OR field two contains any data, and opens the tabbed form respectively on the other form?

View 3 Replies View Related

Modules & VBA :: Conditional Form Formatting Depending On Field

Jul 2, 2013

I created a form that applies conditional formats depending on a field. It works fine, until you enter data into one of the conditionally formatted fields, then all hell breaks loose. Conditional formats totally go away and the cells go to #error.

View 3 Replies View Related

Modules & VBA :: Lock Certain Fields On Form Based On Value In A Particular Field

Aug 4, 2015

I'm trying to lock certain fields on my form based on the value in a particular field. It seems to work the first time but applies itself to all other records in the database from then on!

The starting point is a command button that sends an email and makes Me.DPLLock = 1. The corresponding table entry is formatted as a number.

The code is...

Private Sub Form_Current()
If Me.DPLLock = 1 Then
Me.OR_Name.Locked = True
Me.OR_Sales_Order.Locked = True
Me.OR_WO_No.Locked = True
Me.OR_Qty.Locked = True

[Code] ....

Ive tried Me!DPLLock with the same result.

View 7 Replies View Related

Modules & VBA :: Access 2010 Copy Data From One Field To Another In Form

Jul 1, 2013

I am using Access 2010.Most of the time a tenant pays his exact rent. When that happens, I currently type in the payment (taken form the Rent field) and date of payment (current date) into a form. The date should not change.

I would like to place a checkbox into the form. If checked, the rent would be entered into the payment field and payment date (current date) would be entered automatically. Otherwise, I would just enter in the payment and date manually.

FIELDS
Rent

Payment
PaymentDate

on form chkPayment

View 4 Replies View Related

Modules & VBA :: Show The First Primary Key Field In The Combobox When The Form Loads?

Aug 30, 2013

I'm using a combobox to select a record based off my primary key field, and then a separate button to print that particular record.

When the form loads, it has the first record selected but the combobox is empty so that if I press my button it will still print the first record.

when I press the combobox my list of entrys in the primary key field shows up and the combobox is no longer blank.

How do I show the first primary key field in the combobox when the form loads?

View 6 Replies View Related

Modules & VBA :: Calculating Information For A Text Field On A Form From A Query

Aug 4, 2014

I have a data entry form [Resources] and I would like to display some information about holidays in the form footer. Once the user has picked a combination of Trainer_Name and Start_Date I would like the 'On Change' or 'On lost Focus' event (not sure which would be the best) to perform a datediff calculation.

The datediff calculation would compare the difference between the start date entered on the form and the most recent past Start_Date on a query called [Hours Holiday_P1].I could adapt the same code to also look for the difference between the End_Date on the form and the next Start_Date on the Query.The idea is that when resourcing trainers I know how long it is since and how long it is till their next holiday.The sql for the query is

Code:
SELECT Resourcing.Start_Date, Resourcing.Trainer_Name, Resourcing.Duration, Time.Hours, [Hours]/7.4 AS Days
FROM (Resourcing INNER JOIN Employees ON Resourcing.Trainer_Name = Employees.Trainer_Name) INNER JOIN [Time] ON Resourcing.Duration = Time.Time
WHERE (((Resourcing.Start_Date) Between DateSerial(Year(Date())-IIf(Month(Date())<4,1,0),4,1) And DateSerial(Year(Date())+IIf(Month(Date())>3,1,0),3,31)) AND ((Resourcing.Activity) Like "Holiday*"))
ORDER BY Resourcing.Start_Date;

View 14 Replies View Related

Modules & VBA :: Display / Hide Subforms Based On Yes / No Field In The Form

Oct 4, 2013

I have created a form with 3 subforms on. i was just wondering is it possible to display/ hide these subforms based on a Yes/No field in the form. as the subforms would only be valid if the field is ticked as yes.

View 14 Replies View Related

Modules & VBA :: Open Form To Record With Latest Date In A Field

May 12, 2014

I am trying to make an on-click event that would open a form showing the last inspection done on a site.

Unfortunately, I cannot even first create a dlookup function to use, so I haven't even attempted the rest!

The data needed to reference is in one table, and I just...can't... quite get it.

Here is my last attempt (which at this point probably isn't my best )

Code:
=DLookUp("InspectionID","tblInspections","SITEID = '" & [Forms]![frmFMHome]![txtSITEID] & "' AND InspectionDate = #" & DMax("InspectionDate","tblInspections","SITEID = '" & [Forms]![frmFMHome]![txtSITEID] & "'") & "#")

After breaking it apart I'm pretty sure the DMax function (and using date?) is the culprit, but I can't figure out why.

View 3 Replies View Related

Modules & VBA :: Checking If Data Entered In Form Field Exist

Jan 17, 2015

I want to check if data entered in a form field is existed

The form is bounded to a table

I used this code

If DLookup("Telegram_Number", "tbl_Violation_Of_Building", "Telegram_Number Like " & Forms!frm_Add_Violation_Building!Telegram_Number) Then
MsgBox ("number existed")
Me.Telegram_Number = ""
Else
End If

everything is ok but if the data is existed the database show the message and clear the field but i'm getting a Run-time error

'-2147352567(80020009)': the macro or function set to the beforeupdate or validationRule property for this field is preventing [ISF] from saving the data in the field

I guess the problem because the form is bounded to a table so he will save automatically

My solution is to unbound the fields and save the data via vba but is there any solution with a bounded form???

View 3 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 :: Test If Form Field Fits Within Range Variables

Mar 4, 2014

I have an Access form that gathers students test scores on Reading & Writing exams. Depending on those scores, there are five possible classes for them to be assigned.

I have the intervals worked out, and have created a table that contains the min reading, max reading, min writing, max writing, and class they belong in.

As follows:

tblEnglishPlacement

readMin readMax writeMin writeMax englishPlacement
0 99 0 5 Eng1
55 69 6 6 Eng2
70 99 6 6 Eng3
0 69 7 99 Eng4
70 99 7 99 Eng5

The scores are entered into a form as scoreReading & scoreWriting (integer)

I'm trying to figure out the best way to pull and compare the values and return the proper englishPlacement text. Its set up this way because there are multiple tables to pull from, depending on the date of the exam. Each table has different ranges for each Eng1,...,Eng5.

I'm thinking perhaps to iterate through each column and evaluate T/F, then return the englishPlacement value of the correct row. I'd like to keep this stuff in the VBA so that the code to select a table based upon date doesn't break when the intervals inevitably change requiring an additional table.

View 2 Replies View Related

Modules & VBA :: Change Formatting Of Unbound Text Field On Continuous Form

Apr 16, 2015

I have a continuous form with a text field that says "Select". There are two other fields, one of which is Brand. When the Brand Combo box has nothing in it I want the text box to appear (instructing the user to select a Brand) But once the user selects a Brand and goes to the next records, I would like the "Select" in only that record to become not visible. I tried conditional formatting but can't apply that to an unbound control ( or at least it is grayed out when I select the text box) and any other possible solutions I have found changes all of the selects - not only the one in the changed record.

View 7 Replies View Related

Modules & VBA :: Update Specific Record In Table Using Unbound Field On Form

Dec 4, 2013

How to do an UPDATE using VBA on a form to update a specific record on the table using an unbound field on the form to filter the update.

Every time the code runs, it tells me: Run-time error '3144': Syntax error in UPDATE statement and takes me to the "CurrentDb.Execute strSQL, dbFailOnError" line at the end of my sample below.

Here's my code:

Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " UPDATE [tblTicket] SET"
strSQL = strSQL & " ([UpdatedBy], [AssignedTo], [Requestor], [Dept])"
strSQL = strSQL & " Values"
strSQL = strSQL & " ('" & unbEnteredBy & "','" & cmbAssignedTo & "','" & cmbRequestor & "','" & cmbDepartment & "')"
strSQL = strSQL & "Where [tblTicket]![DateTimeOpened] = #" & FORMS!frmTicketTracker.unbDateTimeOpened & "#;"
CurrentDb.Execute strSQL, dbFailOnError

View 9 Replies View Related

Modules & VBA :: Inserting Field Value When Adding Record Using Data Entry Form?

Dec 14, 2014

I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so

************************************************** ********
Public Function GetTargetType() As Variant
GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]")
End Function
************************************************** ********

Which works fine when I test in the immediate window.Then I have this form event. This however does not insert this value when I am adding records using my continuous form.

************************************************** ********
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!target_group = GetTargetType()
'Forms!frmNmsConsumptionEntry!target_group = GetTargetType()
'[tblNmsConsumption.target_group] = GetTargetType()
End Sub
************************************************** ********

making sure I can insert this value once retrieved.

View 7 Replies View Related

Modules & VBA :: Return A Value From A Separate Query / Have To Show Up In A Field On Main Form

Jun 28, 2013

I want to return a value from a separate query and have that show up in a field on my main form. The field name from the query is "Six Month Date" and the query name is "DT6Monthqry". I want to return the value displayed in the"Six Month Date" from the query, matching the CustomerID in the query result to the CustomerID that is being displayed on the main form. The CustomerID is a text field.This is the code I placed in the Control Source property for the field I want to be displayed on the main form:

=DLookUp("[Six Month Date]","DT6Monthqry","CustomerID=" & [CustomerID])

The result of this displays a flashing "Error" in the field, even when I go to a Customer that I know has a result in the "DT6Monthqry".

View 8 Replies View Related

Modules & VBA :: Text Field In A Form Updated Multiple Times When Filter Is Applied?

Sep 9, 2013

In my Access 2010 database there is a form with a large number of checkboxes enabling me to select/deselect certain record details.

Each click on one of the checkboxes triggers a VBA routine setting true/false values in one of several tables linked to the main table.

A query over all records is filtered by the true/false values of the linked tables and the resulting set of records is displayed in the (continuous) form.

The header of the form contains a text field with the value "=GetRecCount()" displaying (correctly, but randomly fast) the number of records selected:

Code:
Function GetRecCount() As String
Dim NumRecs As Long
Dim rs As Object
On Error Resume Next
Set rs = Forms![Super Search].RecordsetClone
rs.MoveLast
NumRecs = rs.RecordCount
Set rs = Nothing
GetRecCount = Format(NumRecs, "##,###")
End Function

Now, the funny thing is that each click on one of the boxes results in 1 call of the VBA routine setting table values, but 21 calls (!) of the text field "=GetRecCount()" in the form. I have established this by incrementing a public variable at each pass.

Why a field in a form is updated 21 times when a filter is applied?

View 4 Replies View Related

Modules & VBA :: Filter Subform Data - Only Show Records Where Field A Is Higher Value Than Field B

Oct 24, 2013

I want to filter my subform data, to only show records where field A is a higher value than field B.

Code:
Me.MySubform.Form.Filter = "A > B"
Me.MySubform.Form.FilterOn = True

This way it doesn't find field B.

Code:
Me.MySubform.Form.Filter = "A > " & MySubform.Form!B
Me.MySubform.Form.FilterOn = True

This way it seems to filter all record to the field B value of the first record.

View 5 Replies View Related

Modules & VBA :: Unable To Extract Day Number From Date Field And Write It To Day Field

Jan 10, 2014

I am trying to do some simple table operations. I have a field (Date) containing dates, and an empty field called Day.

I want to extract the day number from the Date field, and write it to the Day field.

I didn't get very far until I ran into trouble when setting my recordset. I get the error "Too few parameters, expected 1". Clicking "Debug", will highlight the code line "Set rs = db.OpenRecordset(sqlString, dbOpenDynaset)".

So far, my code looks as follows:

Code:
Private Sub Command16_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlString As String
Dim dataDay As Byte
'Open connection to current Access database
Set db = CurrentDb()

[Code]...

I am not very familiar with the various types of recordset settings. I just want to be able to read data from the Date field, and write data to the Day field.

View 12 Replies View Related

Modules & VBA :: Code To Check Contents Of A Field In A Table Where Another Field

Sep 11, 2013

I am trying create some code that checks if the contents of the status field in a table is "Authorised" where the ID = something specific for multiple records. If all records witht the specific ID are "Authorised" Then generate a new record in another table. Where to start, perhaps a Dlookup?

View 1 Replies View Related







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