Tables :: Update A Specific Record Based On Matching Primary Key ID?

May 22, 2014

My problem is that I am trying to update a field (called 'Sold' which is a yes/no checkbox column) for a specific record whenever an event is triggered. I have two forms (derived from two tables), one is called frmInventory and the other is called frmSales. In frmSales, I made a combo box called 'cboItemID' that allows the user to select from a list of items from my inventory table. Each selection from the list has 4 properties, the first of which is the 'Item ID' from the inventory table. Lastly, I have a field in both frmSales and frmInventory called 'Sold' as mentioned above. What I want to do is that whenever I check/uncheck the box in the 'Sold' field in frmSales, I want the 'Sold' field in frmInventory to check/uncheck as well, but only in the record with an 'Item ID' that matches the 'Item ID' from the combo box selection. In other words, I want to match the 'Sold' field in frmInventory with the 'Sold' field in frmSales, but for only the record that has the same 'Item ID' primary key as the one I picked from my selection in the combo box from frmSales.

how to reference another table and check whether or not it's 'Item ID' primary key is identical to the one I specified from the combo box, and then take action to update the 'Sold' field if the IDs match.

View Replies


ADVERTISEMENT

Forms :: Update Event - Record Based Primary Key

Dec 16, 2013

I want my primary key to be

First 3 letters of surname + first 3 letters of forename + DD + YY (Date of birth)

I can use the after update event to update the primary key field but it won't get saved for some reason so have I missed something?

View 13 Replies View Related

Tables :: Primary Web Based Inventory System - Update Raw Data From Another System

Mar 13, 2014

I have our primary web based inventory system that I am exporting to Excel and using this as an import to Access for the main raw data for my database. This being inventory it changes daily so I am updating this table every day. When I try to append the table it ads all the records. I am wanting an easy way to add only the new records/take out the ones that are no longer there. Basically update the table with what is currently there.The only have I have found to do this is by running non-matching queries and update queries.

View 2 Replies View Related

Forms :: Opening A Form Based On Multiple Tables On A Specific Record

Dec 31, 2014

I have a form "frm_PatientNew" based on table "tbl_patients", this form contains a button "cmd_NewVisit" which is supposed to do the following: opens the form "frm_NewVisit" for recording a new visit for the last recorded patient in "tbl_Patients", I found many approaches depending on DMax and Dlookup and they worked fine just if "frm_NewVisit" is bound to "tbl_Patients", but "frm_NewVisit" is bound to "tbl_Main" which acts as a container for all information (patient data, visit data,service done and service provider), so the form "frm_NewVisit" contains fields from different tables. I wonder if I should create "frm_NewVisit" as unbound form, then adding fields from different tables to it and using vba to populate "tbl_Main",

View 2 Replies View Related

Forms :: Update Record Based On Combo Box Choice And Related Tables?

Jun 3, 2014

In my database I have a table that keeps track of a package of items. The package is assigned a package type (counter display, end cap, half pallet, full pallet for example). The record of the association of the package and it's type is held in the main table.

Each of these package types is either a case or a pallet (counter display and end cap are cases and half and full pallets are pallets) This relationship is kept in another table (we will call it description table).

Now, based on the type of package and therefore it being a case or pallet a UPC and a GTIN number are assigned. The GTIN number is different if it is a case or is a pallet. I have a table that stores all of the UPC and GTIN numbers available in 3 columns, one for UPC, one for GTIN Case and one for GTIN Pallet (the UPC is a standard 12 digit and the GTINs are 14 digit -with the first 2 different to designate pallet or case. and all are based on the check digit formula necessary)

The user assigns the UPC and correct GTIN number by clicking a button which applies the next available UPC code to the package and determines if the description of the type (case or pallet) and inserts correct GTIN number into that field. I actually have all of this functioning correctly.

Now the problem. If a user changes the package type, and therefore changes the description, I need to add code to the update event of the combo box that gives the choices for package type that does the following:

Check to see if the original package type was a case or pallet (it's description) and if by changing the package type it is now changed to the other, update the record in the main table to the correct GTIN number based on the existing UPC Code.

OR as I write this, maybe the code could simply update the main table with the correct GTIN code based on the new description and the existing UPC code. This was I would not need to check for a change just do the update every time.

View 14 Replies View Related

Queries :: Update Query Using Matching Criteria From 2 Tables

Oct 18, 2013

I have 2 tables that must be involved in this query. Both have the same fields; one is a temporary table created from an Excel import which will be deleted later, the other is the permanent table.

tblStoreProducts is the permanent table. It has a 2-field Unique index; there can only be 1 of any ProductKey for a StoreKey (there can be multiple ProductKeys within a StoreKey, and multiple StoreKeys for each product, but there can only be 1 entry for each unique combination of ProductKey/StoreKey).

tblImportToStoreProducts is the temporary table. It holds all of the ProductKeys for one StoreKey.

My query needs to identify any ProductKey in the tblStoreProducts that does not exist in the tblImportToStoreProducts for that StoreKey, and then it must set the MaxUnits field to 0.

Basically, the temporary table is this years' inventory for a particular store. If a product was in that store last year but it isn't there this year, the quantity must be set to 0 because the ultimate aim is reporting hazardous materials.

View 1 Replies View Related

Forms :: Open Query Based Report On Form With Matching Record

Nov 25, 2013

This is my data:

Table: "Facility Info"
Data in the table: "facility", "city", "date", etc.
Query: "Q Facility"
Report: "R Facility"
Form: "Main Form" is where the data is entered that goes into the "Facility Info" table.

In the "Main Form" there is a dropdown box where I can select the "facility".I would like to add a button to this form that opens my report "R Facility". But this report is a collection of all the facilities and I would like it to just report the ones for the facility that I selected from the dropdown box on my "Main Form".

View 9 Replies View Related

Modules & VBA :: Find A Record Based On Primary Key

Sep 6, 2014

I got this function which is supposed to find a record based on the primary key, and then give three fields a value if they should be empty.

Public Function DoesXrefExist(faPersonID As Long, faRoleCode As String, faDorpID As Long, faDorpCode As String)
If (DLookup("PersonID", "PEOPLE", "PersonID =" & faPersonID) > 0) Then
End Function

Thats as far as i have got...for the next part.I get the feeling that i need to use the recordset object that exists somewhere.How do i access that recordset object? I have not been using any DAO or ADO, just straight VBA. I know i can create recordsets and stuff using DAO/ADO, but there must be a recordset that has been created already by the Dlookup command...

View 5 Replies View Related

General :: Select Record Based On Primary Key

Mar 12, 2013

I have an existing database with multiple tables. Two tables have the same primary key Cab#.

1. When user clicks on the form on the menu form, I want to request the Cab# value from the user.
2. Then I want to get the record from the first table CabData based on the entered Cab#.
3. Then I want to create a new record for the second table Rides with five fields from CabData table inserted into the Rides record.
4. Then I want to display the new Rides record to the user for updating.
5. Then I want to save the new record to the RIDES table.

What is the ACCESS termonolgy to do each step? Are there any special details I should watch for?

View 4 Replies View Related

Modules & VBA :: Confirm Changes Using Before Update Based On Specific Value?

Dec 24, 2014

looking to have the following code run only when I have a specific value present in one of my combo boxes: e.g. cbo.status = "Approved"

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Provide the user with the option to save/undo
'changes made to the record in the form
If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub

View 5 Replies View Related

Queries :: Finding Max Record Based On Primary Key In Query

Jul 25, 2015

How to find the max value of a field in a query... How does a query display the max record based on the primary key... want to isolate the last record created, the one with the max primary key.

View 2 Replies View Related

Update Specific Record From Excel

Jan 18, 2015

I'm trying to find best solution for my small "kanban apliccation" on shopfloor

On PC's I have excel form which adding (INSERT function)data to one access database.DB looks like:

ID Stockcode Qt Date
1. Apple 5 2015-01-18 22:35:01
2. Orange 3 2015-01-18 22:36:03
3. Apple 2 2015-01-18 22:37:34
4. Orange 6 2015-01-18 22:39:56
5. Apple 7 2015-01-18 22:41:59

Every row means stockcode and last quantity. How to rebuild function in excel or make a quere or use access vba to have just one stockcode with LAST qt? Qt should be updated somehow based on specific stockcode

View 1 Replies View Related

Modules & VBA :: Displaying Object Based On Specific Record

Aug 11, 2014

I am having bit of confusion in trying to come up with a code that will assist in completing my database display (for a warehouse rental database).

My aim is to have a form display a layout of the site and overlay an image over a store if its occupied else leave the image off if otherwise.

I have everything in my table plus a checkbox field that states if vacancy is "yes' or "no"; say I have 60 stores to rent and they have specific names (unit = A09) and I already 'drew' the layout on a form (all 60 of them) with renaming the boxes for each unit (Name = A09).

How can I program a code that upon opening the form it will like

If 'Box Name on form' = 'unit name on table' AND 'Vacancy = No' then 'redbox.visible = yes'

View 11 Replies View Related

Open Form And Go To Specific Record Based On Variable

Jun 9, 2010

I have two tables and two separate forms. [ID] is the link between them. (I cannot do a subform in this case).

Form1 displays 3 records

Have control button that goes to Form2 where [id] = NumID (NumID is "long" variable)

Have control button on Form2 to go back to Form1. It needs to go to the same record it came from. I don't want use a where clause (e.g., where [id] = [id]). This works, but the form1 is now filtered. I need all records available in Form1, but I want to go to the record it was on when the button was clicked to go to form1

Example:
Form1, record1, ID=30
Form1,record2,ID = 35
Form1,record3,ID = 40

Select record3,ID=40, then click on button to go to form2 (has where clause where ID=40).
Form2 is filtered and is correct.

Click on button to go back to form1. No Filter. It goes to 1st record (record1,ID=30). I need all records displayed, but need to be on record2,ID=35.

View 4 Replies View Related

Adding New Record To All Tables For 1 Table Primary Key Entry

Oct 20, 2006

Hi, I have 7 tables in my database and 1 form corresponding to all the fields in these tables (linked by a query by recordsource). My problem is that the form will only show a record if ALL 7 tables have manually had the primary key entered (not good when i have information that needs to be added at different times). How can I make it such that if I create a new record on the form that all primary key fields will be updated, and this record will be present every time i open my the form??

Cheers

Tania :o

View 2 Replies View Related

Tables :: Populate Date Based On Specific Text In Another Field

Mar 27, 2013

I would like the "DateOfConfirmation" to populate with today's date when "SSurvDiagThisYear" is Confirmed.

The DateRecordCreated is a simple =Date() that populates when the record is entered into the table.

SSurvDiagThis Year is the case outcome - Pending, Probable, or Confirmed. It is possible that the case could be confirmed on the same day it was entered into the table but that is RARE.

I am hoping for the The DateOfConfirmation to capture the date the case is confirmed so that I can gather some duration between the case being opened to confirmed.

SSurvDiagThisYearDateOfConfirmationDateRecordCreatedIdentificationNoPending12/31/2001269Pending4/1/1999270Confirmed7/29/2001338Pending5/14/2009375Confirmed2/20/2012440Pending3/30/2001543Pending7/1/2000552Confirmed3/30/2001596Pending8/3/2001649Pending6/15/2001672

View 1 Replies View Related

Tables :: Unique Record Entry - Index Or Primary Key Cannot Contain A Null Value

Dec 6, 2012

I am building a database to capture monthly statistics on a number of items. I want to ensure that users don't enter statistics for the same item for the same reporting period. I found the following instruction, but can't make it work:

It suggests that I create multiple primary keys in the table

When I do it, it comes back with an error: Index or primary key cannot contain a null value.

View 6 Replies View Related

Dynamically Update Field Of A Current Record Based On Previous Record

Apr 30, 2007

I need a way to dynamically store a particular value in "field_2" of the CURRENT record depending on whether or not the value of "field_1" of the CURRENT record is identical to the value of "field_1" of the PREVIOUS record within the same table. The table is sorted on "field_1".

So, if the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is also "ABC", then store a value of "PPP" in "field_2" of the current record. IF on the other hand, the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is "XYZ", then store a value of "WWW" in "field_2" of the current record.

I have a report that will use these results to count only the number of records that have a "WWW" in "field_2".

Is this doable, maybe in a query somehow?

I should add that whatever the solution, it needs to be compatible with Access 2000.

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

Command Button To Open Another Form - Matching Specific Data Fields

Aug 25, 2011

I have a subform in which I want to put in a Command Button to open another form.

I used the wizard as per normal, but when you come to matching specific data fields, there is nothing in my left hand column of the sub form. I have checked the record source property and it is bound to the correct table.

I have read that this is an issue with Access 2007? Is this the case or am I missing something obvious here?

View 3 Replies View Related

Tables :: Finding Specific Record In A Linked Table

Jun 19, 2013

From what I have read, I understand you can't use the seek command on a recordset from a linked table from another database. Is that true? If so, what is the alternative to find a specific record in the table using an indexed field?

View 4 Replies View Related

Tables :: End User Input To Pull A Specific Record

Dec 5, 2012

I want to use a Form or Report to have the end user enter say a Customer # or the Customer Last Name and then have Access pull and display that record so that the end user can than print all the saved information from that record.

View 2 Replies View Related

Modules & VBA :: Reading Specific Record From Linked Tables

Jul 17, 2013

I have an access 2003 database where the table is linked from mysql.

I would like to know how it is possible to read a specific record from the linked tables using vba code.

View 2 Replies View Related

Forms :: Update Record Based On Two Fields

Jun 30, 2013

how to Add/Update record including existence of record based on single unique field.Now I trying to learn how to check existence of record on multiple field before adding (at least two) and how to update the record with multiple field record

Below is my testing table fields

Year Month Working Days
2013 Jan 20
2013 Feb 17
2013 Mar 22

Now two situations adding a new record and updating the existing record Which means the unique fields are (Year + Month)

View 8 Replies View Related

Query Based Forms Won't Update Tables!

Dec 6, 2005

I have a form which is based on a select query that brings together 2 related (one to many)tables. When I keyin data to the form it does not update the corresponing table.

Is it possible for a table to be updated in such a way, or do I have to create a form based solely on the table(s) without using a query?

View 2 Replies View Related

Update Form Based On Multiple Tables

Feb 9, 2006

My db has several tables tb1, tb2 tb3 tb4 ..... I have link tb1 to tb2 (tb1Id to tb2)and linked tb2 to tb3 and tb4 (tb2Id to tb3 and tb4)
I have created a form with several field from tb1 and tb2 and a single field for tb3 and tb4. All of the fields except one for tb1 are use to make a decision based on what they display. The only field that is updated on the form is a date conversion field from tb1. once you update this field it will auto populate a date field on tb1 with current date. you then have a choice of 4 commands to activate based on what is displayed form the rest of the form.

my problem none of the fields can be updated. can any one help

qry the form is based on

tb1 [Name]
tb1 [ID]
tb1 [date conversion] 'this is the only field that is manualy updated
tb1 [date] 'updated base on date conversion field being updated
tb2 [field]
tb3 [Yes/no]
tb4 [yes/no]

based on what is displayed on the form you have 4 choices of cmd buttons.

View 1 Replies View Related







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