General :: Select A Record From Table

Jun 6, 2013

I am trying to run a sql statement in vba in which it selects all the records in a table related to a order Id number. I then want it loop through all the records and check for a check box which is selected. if its selected then "A" variable becomes "1" and i will then run a if statement saying if variable is 1 then run this code else run code b.

The problem I am having is that if there are 4 records the code checks through all of the 4 records and keeps changing the variable so

record 1 variable is 0
record 2 var is 0
" " " 1
" " " is 0

so although the records for a given order number does have a checked box the code wont recognise that.

What I can do or what code I can add my minds gone all blank on this.

View Replies


ADVERTISEMENT

General :: Shortcut Key To Select Current Record

Jun 2, 2014

I cannot remember (or find) a simple thing like the shortcut key for selecting the current record I am editing.

I have a form (or sub-form, or table even) set as a continuous form. I want to delete a record. I select the "record selector" on the LHS by left clicking on the grey box. I press [Delete]. No problemo.

I do not want my users to see the "record selector" grey box on LHS of my continuous form. I switch off record selectors. Now I am in edit mode, editing data in a field of my record. I decide I want to delete that record by using the [Delete] button. What is the shortcut key for selecting the record so that I can then press [Delete] do this, given that there is no "grey box record selector" to click on?

Same could apply in direct table view. No clicking on grey record selector box allowed.

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

Reports :: Select Most Recent Record From A Table That Is Linked To Another Table

Jul 13, 2014

I have a basic database design, well I think so anyway. It only has two tables:

1. tblClientInfo
2. tblNotes

Basically each client has multiple notes/comments that can be linked to its record, hence the tblNotes table. The two tables have a one-to-many relationship, being that each customer can have many notes.

I then have two forms:

1. Claims Loss Form
2. tblNotes_DatasheetSub1

So I can enter multiple notes for each customer. The problem I am having is with the report output. It wants to print every note (record) that is linked to the customer. I just need it to print the most recent note for each customer (It would save a lot of wasted paper).

Example of a print out of what it is doing:

John Doe - 123 Easy St - Notes 1 (Most Recent Note)
John Doe - 123 Easy St - Notes 2 (Previous Note)
John Doe - 123 Easy St - Notes 3 (and so on...)

It is printing duplicates of the same customer by adding the additional notes for that same customer on a new line.

How can I tell it to only print the customer one time in the report, and most importantly, to only use the most recent note that is linked to the customer?

I tried using DMax("NoteDate","tblNotes"), but this only returns one customer with one note. I need it to do that for each and all customers.

I have successfully ran a subquery (two queries with one linked to another) by following detailed instructions from this page I found: [URL] .... It works, but the problem is it only shows the latest date for each note, not the actual contents of the note. I feel so close with this option, but so far at the same time.

The TOP n records per group looks promising that I found here: [URL] ...., but I honestly don't know how to implement it correctly in my SQL. I am very much still learning Access and apparently have stumbled into something that is much more complicated than I had originally imagined. I just assumed I could filter the duplicates out, or tell access to print the last or most recent note record for each customer.

View 2 Replies View Related

Select Record From Table For A Report If...

Sep 7, 2004

Hello! I am building a report that tracks excessive call-in's for my hospital's employees. Data is entered into a form which then is stored in the table (duh!) "Call-In's." I have a query that lists all those who have more than 5 call-in's.

Here is the problem: In order to get the sum of callin's per person, I did a totals field in my original query and counted on Name. But now I needed to know the sum of each person's, and so I had to do a cross-tab query that included the name, department, the count (from the first query) and then I summed on the count field. What a mess, right? Also, I added a field for If >5, Yes, No.

I based my Excessive call-in's report on the final (above) query. Like this:

Call In's table
Name, Department, Date of Call in, Call in type

Call-in's query
Name, Department, Date of Call in, Call in type, Count of Name

Call-in's crosstab
Rows: Name (GROUP BY), Department (GROUP BY)
Columns: Count (SUM) and total of Count (SUM)

Excessive Call-In's query
Name, Total of count, iif >5, Yes, No

There are already 54 records in the table, one of which has excessive call in's (more than 5).

Is there a way to run a report that not only lists the person's name and number of call in's but also the date of each one and the call in type? Both of these are fields in the call-in's table.

When I try to combine my Call-In's query with my Excessive Call In's query I get the matrix. Example: I get the same record for however many callin's they have. Thank for your help. I'm so sorry this is complicated. I've got to be doing something wrong, or at least inefficiently. Does any of this make sense? Thanks again.

Kelly (the clueless, but I'm trying)

View 3 Replies View Related

Form - Record Source - Select A Table

Nov 13, 2013

Form - record source - select a table that when the user enter a value in the field of the form it gets place into the designated table (select a table). my problem is that I have two fields in the form, one field from the data entry is suppose to go to the train table,and another field the data entry is suppose to go to the station table. if I have the form's record source have a designated table for the data entry.It doesn't have two tables for the data entry.

View 13 Replies View Related

General :: SELECT INTO With Control Of New Table Column Lengths

Aug 28, 2013

I have a SELECT INTO query that pulls info and drops it into a table, after deleting the target table and making it anew upon insertion of the selected records... Is there some way to accomplish the same feat without deleting the target table, so I could retain the target table's fields/field lengths?

I would first set up a target table with fields of specific lengths, and when the data is inserted, the data that fits would insert into these fields, and data that didn't would be truncated..I guess my problem is that when the new table is created it makes all the fields string 255 which is too long when I goto export the data, without having to clip/trim the data for use.

View 4 Replies View Related

Queries :: Select Active Record In A Table Using A Query

Nov 30, 2013

Based upon a specific date (varDate), I want to select the record that is active (who drives the lease car).

row 1 user X from 13/11/2013
row 2 user Y from 15/11/2013
row 3 user Z from 17/11/2013

I want to find the active user on a date. So on date 13/11/2013 (=varDate), user X is active, on 14/11/2013 (=varDate), user X is still active, on 15/11/2013 (=varDate), user Y is active, on 16/11/2013 (=varDate), user Y is still active and on 17/11/2013 and later, user Z is active.

View 1 Replies View Related

SELECT Query To Not Include Record If Already Exists In Another Table

Aug 25, 2015

I have 2 tables:

Query_Rates (Actually this is the result of a query):
Unit
R_Date
Sold_Rate
A
24-AUG-15
145

[code]...

So what I want is a list of all the records from the Query_Rates table where the absolute differences between the sold rates between Query_Rates & [Sent till date] (matching the unit # and the dates) is greater than 1 and the record shouldn't be displayed if it is already present in the [Sent till date] table. But if you notice the first record which has unit A is already mentioned in the "Sent till date" table and shouldn't be repeated again in the query result.

The desired out put should be:

Unit
R_Date
Sold_Rate

X
25-AUG-15
200

View 3 Replies View Related

General :: Select Non-contiguous Records In Access Table Or Query

May 14, 2013

Is there a way to select non-contiguous records in an Access table or query?

View 3 Replies View Related

General :: Records Using A Select Query That Is Sending To A Make Table

Feb 25, 2015

I have records using a select query that I am sending to a make table. I would like to have those records excluded from being used again for 180 days, at which point they can be used again. Essentially, I have an ID and an email address which gets stored in the Make Table. I would need to ensure that if we send an email out in Week 1, we do not send an email again for another 180 days if there is activity from that same ID. On day 181, the ID/email address can then be resent.

View 6 Replies View Related

Modules & VBA :: Allow User To Select Record From Subform And Add It To Table - Insert Statement

Jun 18, 2013

I have a sub form with staff records on it within a main form. I am trying to allow the user to select a record from the sub form and add it to a table, here is my code which, to me, looks correct. However it gives me an error saying "Syntax error in INSERT INTO"

Code:
Private Sub Command3_Click()
Dim dbs As Database
Dim sqlstr As String
Set dbs = CurrentDb
Forename = Nz(Forms!frm_Capex_Submission!frm_staffSub.Form.shy_forename, "")
Surname = Nz(Forms!frm_Capex_Submission!frm_staffSub.Form.shy_surname, "")

[Code] ....

View 1 Replies View Related

General :: Bound Form With Search Box - Select Record In Dataset And Display In Form

Aug 19, 2014

I have a bound form which is from tblEmployee, I'd like to have a dataset below (like a splitform but not a split as they have limits) so when i search in the box it gives me say all the smiths - i select for example david smith and it displays his information in the form objects above so they can be edited?

View 1 Replies View Related

Forms :: Select Record On Subform To Select Default Value In Combo Box?

May 6, 2014

I have a subform containing a list of Funds and attributes such as Asset Type, Fund Manager, etc.

Currently, I have a textbox, where the the control source is set so that it will be updated with the Asset Type from the subform.

I also have an unbound combo box that contains a list of Asset Types queried from a table via row source, where user can select the Asset Type.

What I would like is when a record is selected from the subform, the Asset Type is selected on the combo box as a default value. User can select another Asset Type if required. How can I do this?

View 1 Replies View Related

General :: Add Record To Table And Provide Field ID Value For New Record

Nov 16, 2014

I have the following script which updates fields in a table.What I am after is a msgbox script to list the ID field value once it is updated.

Code:
Set rec = dbs.OpenRecordset("Select * from Stk_Merge_Delete_Register")

rec.AddNew
rec("StkItemID") = [Forms]![MergeItem]![txtStkFrom]
rec("RackID") = [Forms]![MergeItem]![txtRackFrom]

[code]....

View 3 Replies View Related

General :: Button To Add New Record To Another Table

Jan 19, 2015

I have a form wich users input information into and it goes in one table. Several buttons on my form send a report from that table to people.

What I need to to is that every time one of these buttons are pressed and a report is sent, a timestamp and wich button was pressed needs to be recorded in another table in the same database.

This is because I need to record to whom each report was sent and when.

View 4 Replies View Related

General :: Unable To Add New Record To Table

Apr 28, 2015

I have been using my db for 3 years without this particular problem: I am now unable to add records to one of my tables - either through the form or in datasheet view. I have a patient table and a visit table. I put in the patient data using a form and then go to the visit form to add all of the visits for the month. I have never had a problem adding data to any of my tables but now I am unable to add data to the visit table. As much as I didn't want to I brought up last month's back up to enter the patients again. Before I did I checked to see if I could add visits - I could not. So I checked January's back up - same issue. I made no changes to the db before trying to add a visit .

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

General :: Moving Record From One Table To Another Using Inputbox

Jun 20, 2014

I am trying to get a record from tbl_new_accounts to tbl_closed_accounts, based on the number entered in a input box.

Code:
Dim StoreNumber As String
StoreNumber = InputBox("Please Enter The Store Number", "")
CurrentDb.Execute ("INSERT INTO Tbl_Closed_Accounts SELECT Tbl_New_Accounts.* From Tbl_New_Accounts WHERE (((Tbl_New_Accounts.Fld_Store_Number)=" & StoreNumber & "));")

View 1 Replies View Related

General :: Adding New Record To A Table By Using A Mask

Aug 23, 2014

I need to add only one record into a database by using a mask.

For sure when I call this mask via a button, this new record has to be added after the last one.

Someone is suggesting me to use function docmd.openform, but I really dont' know how to do it.

View 3 Replies View Related

General :: Adding New Preset Record Into Second Table

Feb 26, 2013

I was trying to further my knowledge of access. I have a database that is suppose to be used a s a simple budget database.

Form: StartingAmount
Table: StartinAmount
Field: StartingAmount
Button: Create

Form: Transactions
Table: Transactions
Field:
TransactionDate
TransactionName
TransactionAmount

When the database is open the form StartingAmount is open (only until a starting balance is entered.)

User then puts the starting amount in. clicks create.

Then a record is added to Transactions.
TransactionDate = Date entered (auto populate)
TransactionName = Starting Balance
TransactionAmount = StartingAmount

I tried this code:

DoCmd.RunSQL "INSERT INTO Transactions (TransactionAmount) " _
& "VALUES(" _
& "'" & Me!StartingAmount& "') "

With this it kept giving me an Append error and Im not sure how to get it to stop and how to add all the fields needed.

I tired to do:

Code:
INSERT INTO Transactions([TransactionName], [TransactionAmount])
VALUES ("Starting Amount", Me.StartingAmount)

But i keep getting an expected error in the VBA side.

View 3 Replies View Related

General :: Adding A New Record To Linked Table

Aug 5, 2014

I have several tables that are linked that I need to be able to add to. This is an example of the structure:

Patient Info
ID
FK_Ward - ID of Ward table
FK_Room - ID of Room table
FK_Cond - ID of Condition table

Ward
ID
WardID

Room
ID
RoomNumber

Condition
ID
Description

Unfortunately, its not the exact one as I can't post that here! What I am trying to do is to add a new patient record using information from the other tables as guides - e.g. the user selects the name of the Ward but the ID in the Ward table is entered, the User selects the number of the room but again the ID in the Room table is entered, and for the Condition same thing. So I would like to have dropdowns (or ComboBoxes) for each of these and based on the user's selections add a new record to PatientInfo using the ID values as links.

View 4 Replies View Related

General :: Exporting Every Single Record From Table To PDF?

Oct 13, 2014

I need to export/print every single record from table as a pdf file (one record one pdf file). how to do this.

I'm working on Access 2000.

View 1 Replies View Related

General :: Move A Record To Another Table Automatically

Sep 18, 2012

Using access 2003, i would like to add a button to a form so that when clicked all the data in that record is moved (cut and paste) to another identical table, like archive.

View 5 Replies View Related

Forms :: Select Record From Combobox List And Have Record Populate In Subform

Sep 16, 2013

I would like to select a record from my combobox dropdown list and have that record populate in my subform. Currently, I am only able to select the 1st record at the top of the dropdown list to appear in my subform. But I would like to select any record from the dropdown list and have it populate my subform.

View 8 Replies View Related

General :: Creating History Record From Another Table Values?

Jan 20, 2014

I have a table that deals with current data (as in member rentals of items). The normalized tables that we have been given include a rental history table. The idea is that, when the member has returned the product a history entry is made in the completed rental table.

I wish to have a button which is clicked to triggers this event. Would I program a macro to do this? In other words, would I create an event that passes those values to the relevant fields in the other table (Name, date issued, return date etc)?

View 9 Replies View Related







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