Update Separate Table When Record Is Edited

Aug 5, 2015

I have a form where a user can change the scheduled start date for a job. On a sub form on the same screen is a list of notes relating to that job.

Any notes added, automatically have todays date and are locked when the user clicks off.

When the scheduled start date is changed I need a note to be made. Either forced, then entered by the user or automatically.

I was thinking of making the scheduled start appear in a small form and the button to make it come up could add a new note on the click event (possibly in a message).

Or even better (probably harder) any time the value is changed in the form a new note is added.

Other options could be a pop up form to add one note on a change.

View Replies


ADVERTISEMENT

Update Query Based On A Separate Table

Nov 24, 2005

Hi all,

This is quite a basic question and I'm sure that it has been posted here some time ago, although I couldn't find it on using the search.

I want to update a field in one table "FieldA" using an update query. I want the update to be based on matching Field B in the updated table, and Field C in a separate table (both tables have the same design structure).

That is, I'd like my query to search each record in the Destination Table to see if its Field B matches a Field C in a separate Table. If there is a match, I'd like to Update Field A to the corresponding field A of the reference table.

I have tried to do this with an Update Query based on both Tables in design view. Thus far, it hasn't yielded any results.

Can someone please post the solution asap. Thanks so much for your help.

Regards,

Mike J.

View 4 Replies View Related

Update Field On Separate Table If Result From Form Equals Certain Criteria

Mar 17, 2012

I have a form, which i use to book in products received. What i want to do is if the quantity received is equal to what was ordered then i'd like to update a yes/no field (Order Complete) on a separate table to true.

View 8 Replies View Related

Create New Record & Pass Autonumber To Separate Table

Mar 10, 2008

I have a form, frmSub, that contains the combo box comProducts. I also have two tables, Products and PurchaseDetail. Both tables have the field ProductID.

I want comProducts to create a new record in the Products table, using the input in a field called Product and then to use the value of ProductID to create a new record in the PurchaseDetail table. Ie, so the PurchaseDetail table has a record that links to another record in the Products table via the feild ProductID.

I hope I was semi-clear.

View 4 Replies View Related

Modules & VBA :: Write Separate CSV File From Each Record In A Table

Jun 22, 2015

I have the requirement to write EACH record from a table to its own CSV file with name of the file being combination of 2 fields

So let's say I have Table1 with 3 columns (Field1, Field2, Field3) with following content :

Field1 Field2 Field3
AA 1 ABC
AA 2 DEF
AA 3 GHI

I should get 3 files with names AA1.CSV, AA2.CSV and AA3.CSV and each file contains its respective row from the table.

I tried to do it with DAO Recordset, but I do not find a way to write only the current record from recordset while looping.

See below the code I was using, but issue is that code does succesfull creates the 3 CSV files as per above example, but in each file it writes ALL 3 ROWS instead only the respective ROW.

Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strFilename As String

[Code] ....

View 10 Replies View Related

General :: Simple Audit By Posting Whole Record To Separate Table?

Jul 30, 2014

I need a simple audit capability

I have a table (Called Master Active List)

I have an empty duplicate of it called History of Master Active List. (Identical fields, with the addition of a distinct ID (primary key)

I have a form where the master can be changed (Called customer details)

When any change is made I want to post the whole record to the history table

1 - Am I correct I no longer need a form based one,(office 2013) and can do one on the data table itself?

I want to capture everything, can this be done with a wildcard, or do I need to go line by line?

The master table has a ton of fields.

View 3 Replies View Related

Queries :: Appointment Database - Query Most Recent Entry For Each Record In Separate Table

Jun 20, 2013

I have a database that is used to allocate appointments to our staff. It has 2 tables, one that lists the clients we need to call in that day, and another that stores details of each contact attempt. I'd like to design a query that find all clients who we have not dealt with so we can easily get their details in a list. I know what the criteria for the query would be, but I'm stuck for how to actually execute it. Here are the details.

Table tClients stores the current clients - primary key is named "clientRef"
Table tContactEvents stores each contact attempt and the date/time is stored in a field named "dateTime".

When an entry has been dealt with successfully a yes/no field named "completed" will be set to "Yes".

There may be many attempts to contact a specific client on a given day, unsuccessful attempts will not have the completed flag set.

Once the completed flag is set that client will be ignored so no further entries will appear.

So I need a query that searches tContactEvents for the most recent match to each number in tClients.clientRef and checks if the completed flag is set. If the completed flag is false, or if the number has no match (i.e. no contact attempts made yet) then the clientRef should be displayed. I also need this to be restricted to the current date, as the same client could have rebooked their appointment to a different day.

View 10 Replies View Related

General :: Update Record ID To Another Record ID In Same Table And Update Related Records

Aug 22, 2013

I have a table called tblCompanies. When a company acquires another company, I need a method by which the acquired company's CompanyID (PK) can be updated to the new company's CompanyID (PK). I also need to be able to update all related CompanyIDs (FKs) to the new value in related tables.

In cases in which the new company does not have an existing record, there is no problem: the company name simply gets changed to the new company and the existing CompanyID is maintained. I then use an audit table and Track Changes function to keep track of the company name data and a union query to keep the old names in the selection lists.

The problem is when both companies already have existing records in the table.

So, let's say I have records for Company A and Company B. Company A merges with Company B and Company B is now the main record. What is the best, simplest and easiest way to update the CompanyID (PK) from A to B and change the CompanyID (FK) to the new value in all related tables?

I am envisioning a pop-up form that directs the user to select the new company and then an update query happens behind the scenes... but exactly how does the criteria for the update query get selected and how do all the related tables get updated? My vba skills are pretty basic, will I need extensive coding to do something like this?

View 6 Replies View Related

Q? Find Last Edited Record Using DMax And FindRecord

Oct 27, 2004

Hi,

I have a database / form with a hidden timestamp field [LastEdit]
that is filled automatically with the current time Now() when updated.
The purpose is that each time the form is opened I want it to "Goto" the last edited record.

I *think* I get around the find edit quotes because the smaller snippets below do work.

findit = DMax("[LastEdit]", "esn")
MsgBox DMax("[LastEdit]", "esn")

But the whole thing fails when I put it into one command as either one of these
DoCmd.FindRecord DMax("[LastEdit]", "esn"), , , acSearchAll
or DoCmd.FindRecord findit, , , acSearchAll
perhaps because of the quotes around the variable.

Any ideas?

Thank you,

View 4 Replies View Related

Adding A New Record, But Not Allowing Old Records To Be Edited

May 6, 2005

I have a problem that should have an easy solution. But I can't find it.

I need to have a user add a new record. (Created a form with the fields on it, No problem , so far.)

The problem is when the user is adding a new record if they hit the PAGE DOWN Key or the mouse scroll, they then go to a new NEW record. (And if they are not paying attention they now have two new records)

How do I prevent this.

Thanks

Mike Lester

View 2 Replies View Related

Goto Previous EDITED Record On Continious Form

Sep 29, 2005

Hi All,

I have a continious form where each record can be edited. After editing a record the form does a me.save and a me.requery (is important). After this it jumps back to the first record (seems logical), but how can I write a code that he goes back to the 'previous edited record'.

Thanks.

View 4 Replies View Related

Duplicate Data Error While Saving An Edited Record

Jan 8, 2005

Having a problem when saving a record that has been edited and contains a duplicate field. Here is what I'm doing.

I have an existing record that is being viewed by the user. I have an edit button on the form that is displaying the record. When the user clicks the edit button I do the following

'User clicked on edit customer record

Private Sub CustEditRec_Click()

'Store current customer key in string so we can cross

'check if user has changed the key during edit

EditCustKey = Me.txtCustomerKey

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'Set customer record test string so we can determine

'what the user is doing

CustomerRecStat = "edit"

' Go unlock the customer data fields for editing

UnlockCustomerFields

TxtCompanyName.SetFocus

'Go Unlock the customer editing buttons

UnLockCustomerAddButtons

'Lock the add, delete, edit buttons

CustAddRec.Enabled = False

CustEditRec.Enabled = False

CustDelRec.Enabled = False

'Go Disable the customer navagation buttons

DisableCustomerNavigation

txtCustomerKey.Visible = True

txtCustomerKey.Locked = False

txtCustomerKey.Enabled = True

'Set focus on the customer key

txtCustomerKey.SetFocus

'disable & hide the customer key combobox

cmboCustomerKey.Locked = True

cmboCustomerKey.Enabled = False

cmboCustomerKey.Visible = False

Exit_CustEditRec_Click:

Exit Sub

Err_CustEditRec_Click:

MsgBox Err.Description

Resume Exit_CustEditRec_Click

End Sub

The field which duplicate entries are not allowed in the table is txtCustomerKey. Now remember we are just editing a record NOT ADDING A NEW ONE.

When the user finished making the changes to the record we use the same procedure to save the changes as we when the user is adding a new record...here it is.

'User clicked save customer record

Private Sub CustSaveRec_Click()

On Error GoTo Err_CustSaveRec_Click

SaveCustomerRecord:

'Update the table data fields with the data contained on the form

CustomerKey = Me.txtCustomerKey

CustomerCompany = Me.TxtCompanyName

CustomerFirst = Me.txtCustomerFirst

CustomerLast = Me.txtCustomerLast

CustomerAddress = Me.txtCustomerAddress

CustomerCity = Me.txtCustomerCity

CustomerProvince = Me.txtCustomerProvince

CustomerPostal = Me.txtCustomerPostal

CustomerCountry = Me.txtCustomerCountry

CustomerPhone = Me.txtCustomerPhone

CustomerFax = Me.txtCustomerFax

CustomerEmail = Me.txtCustomerEmail

CustomerWeb = Me.txtCustomerWeb

CustomerNotes = Me.txtCustomerNotes

'Save the record

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'*** IF WE GOT THIS FAR WITH OUT ERRORS WE SAVED THE RECORD

'*** GO AHEAD & DISABLE THE FORMS VARIOUS FIELDS

'*** & BUTTONS ONCE AGAIN AS WE ARE JUST BACK TO VIEWING

'*** THE CUSTOMERS DATABASE

'Enable and unlock the customer key field

txtCustomerKey.Visible = True

txtCustomerKey.Locked = False

txtCustomerKey.Enabled = True

'Hide & disable the customer keycombo box

cmboCustomerKey.Locked = True

cmboCustomerKey.Enabled = False

cmboCustomerKey.Visible = False

'Set focus on the customer key field

txtCustomerKey.SetFocus

'Lock the customer fields

LockCustomerFields

'Enable the navigation buttons

EnableCustomerNavigation

'Lock the customer adding buttons

LockCustomerAddButtons

'Clear the record testing status

CustomerRecStat = ""

txtCustomerKey_AfterUpdate

Exit_CustSaveRec_Click:

Exit Sub

Err_CustSaveRec_Click:

'If the error generated was by a duplicate value.

'This can only be caused by the customer key as this

'is the only field which does not allow duplicate values.

'so warn the user of this duplicate value error and set

'the focus on the customer key field

If Err.Number = 3022 Then

'if user is editing a record

If CustomerRecStat = "edit" Then

'And the entered customer key has not changed

If Me.txtCustomerKey = EditCustKey Then

'Return to saving the record as the key is

'not really a duplicate

GoTo SaveCustomerRecord

End If

End If



Select Case MsgBox("This Customer ID was already located in the database. Click OK to enter a new Customer ID or Cancel to stop adding this record?", vbExclamation + vbOKCancel + vbDefaultButton1, "Duplicate Customer ID")

Case vbOK

Me.txtCustomerKey.SetFocus

Resume Exit_CustSaveRec_Click

Case vbCancel

'Go simulate undo record click

CustUndoRec_Click

Resume Exit_CustSaveRec_Click

End Select

End If

MsgBox Err.Description

Resume Exit_CustSaveRec_Click

End Sub



The problem is when the user is editing a record. The database assumes the txtCustomerKey is a duplicate in the table. However we are not adding a new record so the duplicate error is false. Its just that the txtCustomerKey is the same as the record being edited. Its not DUPLICATED its the SAME.....



Any help anyone? Sorry for the long post but I'm a strong believer in the more information the better when trying to solve a problem....

Thx

Kao

View 1 Replies View Related

Creating New Record When Record Is Edited?

Feb 20, 2015

I'm working on a project that has project start / end dates which can change. A report is created based on this data. The customer wants me to save all changes as a new record and disregard the older record when the report is created. I was thinking that I would add a (yes/no) column that marks the new record as the most recent (yes) and marks older records as (no). Then I would modify the query for the report to only include records with 'yes' set to true. I was also thinking that I should create a second table that has a foreign key for the original record from the main table. The main table would have the most recently edited record while the second table would have the previous records. Which method should I use?

View 3 Replies View Related

Queries :: Field In Table Doesn't Change When Edited From Query

Mar 29, 2013

Users are viewing a record on a form that gets it's data from a query. I want to make it so that if they edit that record from that form, a last updated field will timestamp the date/time that the record was edited. I added a lastupdated to the source table which of course adds it to the query and so it's on the form.

But whenever i access the form and change something, the lastupdated only shows the time the record was created (which is from a different form based directly on the table). Whenever I edit any other field data in that query based form it changes in the table. Why not the Lastupdated?

View 2 Replies View Related

Get To A New Subform Record From A Separate Form

May 30, 2006

Hi,
I think what I want to do is simple but I can't figure it out. I've tried searching the forum for the solution but I'm having trouble with what I've found. Here's what I'm trying to do: I'm composing a text string on one form (recipe ingredient) and, once it is complete, I want to add it to the records in a subform on a separate form (the recipe). The string composition works great, and I can use:

Forms!frmRecipe.fsubIngredients!txtIngredient = Me.txtEntry

to paste the string into the textbox on the subform. The problem is "finishing" the record in the subform. When I prepare a new string for the next ingredient, it copies over the previous string. So, I'm not moving to a new record in the subform. I've tried:

DoCmd.GoToRecord , "frmRecipe!fsubIngredients", acNewRec

but Access tells me the form isn't open, which isn't true.

So, what I want (I think) is a way to direct the subform to move to a new record before I paste in my text string. Or, to direct the subform to move to a new record after I paste in my text string.

By the way, the subform has a before insert event that copies in the record id of the recipe for the new record holding the inserted text string, so the table relationships will be fulfilled:

Private Sub Form_BeforeInsert(Cancel As Integer)
Me!lngRecipeID = Me.Parent!lngRecipeID
End Sub

I'm pretty sure I'm missing something simple here, and I really appreciate anybody's effort to help me get it right.

Thank you!!!

View 1 Replies View Related

Noob - Update Record In Table

Sep 13, 2005

Hi all,

First of all....my first access database and I'm still a VB newbie...so my apologies if this is a stupid question. I tried searching the web and this forum but could'nt find what I was looking for.

Basically, I am developing an authentication script for a training tutorial. The user either logs in with there existing info, or prior creates a new record. When they login they also select a team (eg Team 1, 2, 3, 4, admin and so on). This is selected from a combo box - the teams are on their own table.

I have another table storing the user info - name, password, the users team...and so on. When they log in and the team selected does not match the team in 'tblusers' - I want access to change the record to reflect the new team.

Can anyone help me with the code to make this happen? So far I have -

If Me.defineteam.Value <> DLookup("Team", "tblusers") Then
MsgBox "You have changed team. This will now be updated", vbOKOnly, "Required Data"
GoTo verifypassword:
End If

This authenticates the team....I just don't know how to replace the one in the record with the value in the combobox.

Thanks for your help.....I'm losing hair!

cheers

Sd

View 7 Replies View Related

Update Two Records In One Table From One Record In Another

Oct 14, 2004

Hi,

I am creating a league table for my soccer team.

I have a database with these tables:

1. teams
2. league_table
3. fixtures

The Fixtures Table has a lookup where it pulls in the opposing teams - home_team & away_team. There is also Home_goals & away_goals. How can I get the fixtures table to update each teams goals in the league_table table where these details are held.

Anyone any ideas on how this is done?

Thanks in advance.

View 1 Replies View Related

Export Each Record To Separate Text File

Jun 30, 2005

I would like to export each record of an access table to a separate text file and use one field of each record as the source for the file name of each exported text file.
Does anyone know a way of dong this?

View 3 Replies View Related

How To Print Each Record Of A Group On A Separate Page

Oct 23, 2004

I have a report with field "Plot" as Group Header. I need to print the report
which lists the owners of each Plot. When the number of owners is large, it takes more
than one page for the listing. How can I force a new page for each new Plot ?

View 2 Replies View Related

Reports :: Create Separate Report For Each Record

Apr 13, 2013

I have a query which displays only the records that match the criteria in the form given before. Now i want to create separate report for each of these records. How should i go about with it? I don't want a seperate form for this purpose, is there any way to do the same with a macro?

View 1 Replies View Related

Update A Record Of One Table And Save The History Of Changes In Another.

Jun 10, 2007

Hello!
I am trying to update the current status of an asset, when it was returned or checked out. At the same time, save the changes in a history table to record all the changes in past. I can do individually from different tables and different forms, but I would like to do from one form and one record entry. Is it possible? If so can anybody help?
Thanks
JVirk

View 4 Replies View Related

Modules & VBA :: Update Record With Info From Another Table?

May 12, 2014

I have a database which tracks product batches test results and then any reported issues.

I have one table tblOne with [Batch Number] and [Release Time/Date].
The 2nd Table tblTwo [Problem/Issue] at [Time/Date].

What i need to do is get the last batch number from table one which would have been released.

Example:

Batch: 275 Released: 21/09/2012 06:15
Batch: 453 Released: 30/09/2012 07:20

Problem: Wrong Batch Time/Date: 21/09/2012 08:20 Batch:????

How would i update table with correct batch in tblTwo

View 3 Replies View Related

Automatically Exporting Each Record To Separate Text Files

Aug 23, 2007

Hi all,

I've seen a lot of repeated questions from newbies about exporting to text, but so far I haven't come across a scenario like mine. Apologies if I've overlooked something.

I'm using Access 2003 and I have a database that contains a record for each article that appeared in a certain newspaper over the last 30 years (~70,000 records). Each record has a field for year, month, issue, page, title, and text. The text field contains multiple lines of HTML as well as the text of the article itself -- the program designed for viewing these articles calls on this field to create an html document that resembles the original newspaper page in the GUI.

What I would like to generate is a separate .TXT file for each article containing just the text of that article and a filename system that identifies each file by year, month, page, and possibly title (i.e., about 70,000 separate text files). I'm not sure if I want the title within the document or just in the filename, but I'm assuming that wouldn't be difficult to change.

In other words, I'm trying to work backwards, reconstructing the text files that the person who made the database probably has sitting on a disk somewhere (but I don't have access to).

I've read about using the TransferText method, setting up an export spec and looping it in VBA, etc., but the closest solution appears to be Microsoft's page on exporting records to separate HTML files (http://office.microsoft.com/en-us/access/HA010345961033.aspx), which mentions: "You can create a Microsoft Visual Basic for Applications (VBA) program that enumerates through the record set and uses the PRINT statement to output each record as a separate HTML file." After doing this I guess I would batch convert from HTML to TXT. Unfortunately I am new to Access and don't know VBA.

Can anyone provide any suggestions?

Thanks,
Jim

View 4 Replies View Related

Modules & VBA :: How To Publish And Save Each Record Report In Separate File

May 24, 2014

Trying to make this code work, don't know how to filter as it prints identical all reports.

Private Sub cmdExportPDF_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyPath As String
MyPath = "C:Reports"
If Len(Dir(MyPath, vbDirectory)) < 1 Then
MkDir (MyPath)

[code]....

View 14 Replies View Related

Tables :: Way To Separate Data In The Cell Into Separated Cells In A New Record?

Jan 21, 2013

I use a Access database to import data from an email generated from google docs..When the data imports to the table it creates a "Memo Field" with several lines of carriage seperated data containing the Form Field name & answer. (ie: Firstname=John, Surname=smith, etc)Is there any way to seperate this data in the cell into seperated cells in a new record?

View 1 Replies View Related

Tables :: 2 Table To Generate Separate Matrix Table

Mar 9, 2014

I have 2 tables

- Staff Position(Unique Position Name, Description, Hierarchy)
- Training (ID, Name, Description etc.)

I essentially want a table with Staff Position as the Field, and Training as the Rows. The intersecting entries/matrix will be Yes/No to say whether that staff positions requires that training.

Simple Example

..................... Worker ........ Senior ........ Principal
IT Training ......YES ............. YES .............. YES
Accounts ......... NO ............. YES .............. YES
Management ... NO ............. NO ............... YES

I need the user to be able to add as many training entries and as many staff positions as they want. It doesn't HAVE to be that sort of format...

View 4 Replies View Related







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