Issue With Insert Query Into Table

Nov 7, 2007

Hi,

I wonder if i could get some help here with the SQL insert into table. I got Syntax Error when executing the following code

strSQL = "INSERT INTO [Time Sheet] (SFirstName, SLastName, Department_No, Status, subject_taken)"
strSQL = strSQL & " VALUES ('Mike','Fraser','01','FullTime',3)"

WorkBase.Execute strSQL, dbFailOnError
WorkBase.Close

Time Sheet table:
SFirstName - type(text)
SLastName - type(text)
Department_No - type(text)
Status - type(text)
subject_taken - type(number)

Everytime i remove the subject_taken field and 3 from the insert query, it works nicely.

The field size of the subject_taken is double
Decimal places = auto
default value = 0
required = no
indexed = no

Is there a proper syntax for inserting data field of type double?

Thank you in advance

View Replies


ADVERTISEMENT

Tables :: Use Insert Into Command To Insert Filepath Into Table That Adds Blank Label

Aug 28, 2014

I am at work, and I have acquired a database that prints labels. They now want the database to be coded so that after certain labels are printed the database will print a blank label. I have the code figured out as a Do While statement in order to print the blank label. The problem I am having is that I am trying to use the Insert Into command to insert the filepath into the table that adds the blank label.

|DoCmd.RunSQL "INSERT INTO Rod_tmakLabels ( Print, [Order] ) SELECT Yes AS Expr1, 'Rods Labels' AS Expr2"|

If I run the above command, it just adds the text "Rods Labels" at the end of the table. Is there anyway with the INSERT INTO command that I can insert the new label between the 2nd and 3rd row and add another row? Or is the command designed only to add a new row to the end? I haven't had any luck searching for this yet.

View 1 Replies View Related

Queries :: Query To Insert Missing Rows From Another Query / Table

Oct 8, 2013

I am using an Access 2010 DB to keep track of a schedule. Essentially, at least one person needs to be signed up to work for every hour of every day in a week.

Tables:
Days with 7 records
Hours with 24 records
Workers with as many people that sign up to work the different hours
Schedule signifying the worker, day, and hour which are signed up.

As of now i have a query that relates these results and gives me a line detailing the worker/time information for the slots that are signed up for.What I'm TRYING to do is to create a query that gives me BLANK worker info when there is no one signed up for a particular hour.Currently my Schedule table has the following:

WorkerID | DayID | HourID
----------+---------+--------
1 | 5 | 12
4 | 5 | 13
16 | 5 | 15


What I'm looking to do is have this table matched up with another table (or query) that provides every combination of day/hour. When an day/hour combination is skipped, the query will be able to "fill in the blank" with a row. Like this:

WorkerID | DayID | HourID
----------+---------+--------
1 | 5 | 12
4 | 5 | 13
| | 14
16 | 5 | 15

View 2 Replies View Related

Queries :: Insert From A Query To A Table When Query Is Changed

Jul 10, 2015

I work with access web database. In access web aggregate functions are disabled in query design. So I made a query in client and i thought then i can insert this data to another web table. but i don't know how to update this table.

Because the source table of the query is also updated.

I upload the database with a table in it and a query. I want to add the data of this query to another web table....

View 1 Replies View Related

Insert New Field/Value In A Make Table Query

Sep 24, 2007

Hi all,
stumped on an issue I thought would be pretty straight forwards (again) so i'm hoping to find the answer here! I have a make table query which produces the table using fields from three other tables and it runs fine however I now want to insert a new field with the value "Current" in it, and, if possible, an Autonumebr ID field as primary key. I'd like this is all done in one query so not sure if it will fly but if anyone can advise me I know someone from here can help.

Thanks in advance,
Mitch......

View 1 Replies View Related

Queries :: Insert Query Result Into A Table

Jul 19, 2013

there is a query which i made which counts data from two tables RAUTH AND PERS

SELECT RAUTH.coy, RAUTH.Auth, Count(RAUTH.coy) AS Held
FROM pers INNER JOIN RAUTH ON pers.coy = RAUTH.coy
GROUP BY RAUTH.coy, RAUTH.Auth;

THERE IS A BLANK FIELD NAMED HELD in table RAUTH i want to update the held result which i quired into HELD fiedl of RAUTH table where COY (Field) is COY field of PERS table

RAUTH table structure

Coy Auth Held

Tata 12
Dell 11
HP 21
Opera 11
Bangour 10
pers table

Persno Name Coy Qual

124578 Gita Tata Bsc
235689 Sonu Dell BA
748596 Kiran HP BCA
459687 Sony Tata MCA
965214 Baiju Bangour CCNA
963656 Ashok Opera MCA

View 4 Replies View Related

Queries :: Insert Query Result Into Table Column

Jul 19, 2013

How to take the results of query and copy them to a column in a table?

I am using sharepoint and ms access together, and Sharpoint in this instance will not reference the result of the query. I can only use table fields with Sharepoint...major pain....

Example, I need riders name, weight and height from the column in ALL INfo query to automatically fill the column table in ALL Info

queryreservations!AllINfo.value=tablereservations! Allinfo.value

and how to loop through records that are not filled out already?

seems like it should be a simple Do.command but I am not sure how to code it..

View 1 Replies View Related

INSERT Query - Insert New Data Only

Jul 2, 2010

Table TBL_NEWDATA is used to append new data to table TBL_PERSON_ALLOCATIONS.

TBL_NEWDATA { Person_ID, Department_ID }
TBL_PERSON_ALLOCATIONS { Person_ID, Department_ID, ... }

I need to devise a query to append data for a particular Department_ID from TBL_NEWDATA to TBL_PERSON_ALLOCATIONS where that data does not already exist there. i.e. for Department_ID 'Research', I would want to append 'Person_ID', 'Department_ID' (in this case: 'Research') to TBL_PERSON_ALLOCATIONS for any tuples not already held.

INSERT INTO TBL_PERSON_ALLOCATIONS (Person_ID, Department_ID)
SELECT Person_ID, Department_ID
FROM TBL_NEWDATA
WHERE TBL_NEWDATA.Department_ID='Form...'

[code]...

This Query takes a single argument from a control (Forms!Main!IN_Department), and this is the Department_ID to be updated.Is there any way to do this using a single query or will I have to use sub queries? I'd hoped not to as to keep the database as concise as possible.

View 2 Replies View Related

Queries :: Access 2007 - Insert Into Table Where Source Is Another Table And Form

Feb 3, 2015

If you want to use a "DoCmd.RunSQL "INSERT INTO" command to insert data in a table and the data to insert comes from a table and a form, could this be done in one pass?

So...writing a record wit 4 values from table1 together with a additional value from a textbox in table2 as 5 values.

View 5 Replies View Related

Modules & VBA :: Parent Table Revision History - Insert Multiple Records Into Child Table

Sep 8, 2014

I have a parent table (tblLabels) and a child table (tblRevision) where the revision history for the parent table is kept.

The parent table is populated via an excel import and may have several records imported at once. Instead of having the user manually enter a new record note in the child table for each record imported into the parent table, I've created a form that collects the necessary data (date, person who added the record, person who authorized the record, and notes) and then creates a revision history for each new record.

This is what I have so far:

Code:

Private Sub cmdAddNotes_Click()
Dim strSQL As String
Dim RevisionDate As String
Dim RevisionRevisedBy As String
Dim RevisionDesc As String

[Code] ....

When I run the code nothing happens. No error, no new records create, etc. My suspicion is that I may need to use an INSERT INTO query instead of an UPDATE query, but I'm not sure how to go about matching up the foreign keys if that's the case.

View 14 Replies View Related

Insert Records Into Table Based On The Select Criteria From The First Table.

Mar 22, 2005

Hi

I have a small database with 4 tables that I am using for the current problem.
The tables are call, parents, mailman, orders.
Call and parents are related by the call ID (a primary key in the Call table.).
Mailman and orders are related by a Unique Id (a primary key in the mailman table.).

Forms involved are frmmain and frmsub.

Frmmain contains the call table information in the main form and parents information in the subform.

When a user enters a call with call ID and enters the operator name and parents information in the sub form,
When a user clicks the OK button on the main form, necessary changes should take place
if they enter the case type in the sub form part of parent information as ‘missing information’ or ‘missing link’ then the parent information with fields first name, lastname, case type, operator information should be inserted into mailman table in appropriate fields.

Simultaneously a record should be inserted into orders( after the record is first inserted into mailman, since both tables are linked with unique id) with the following information.
Orderid being autonumber.
Uniqueid from the mailman table.
Orderdate system date.
Ordertype should be “Mailman”

View 4 Replies View Related

How To Copy A Column From One Table And Insert It Into Another Table In The Same Db

Feb 3, 2006

How to copy a column from one table and insert it into another table in the same database

Hi, All,

I have two tables (old and new) sitting in the same database. The new table is the result of 'data cleansing' done by an external company. In the process (export and import via excel) two memo type colums in the table were truncated in excel.

To make the new table usable, I must therefore now copy/insert the two memo columns from the old table into the new table.

Both tables are already Access tables and sit in the same database. Both tables, of course, have the same number of rows.

I tried to high-light one column in the old table, clicked copy, then high-lighted a blank column in the target table, then clicked Paste, but got error msg: "This text is too long for this field. Try copying a shorter text", as if I had wanted to copy the whole column into one cell rather than one column into another column of equal length.

What is the best way to proceed?

Thanks for your help.

Adrian

View 4 Replies View Related

Insert X Records In Table Based On Value From Another Table

Jan 9, 2007

Newbie question: I have a database where we track dispatched with two tables, one called Slots, the other called Dispatches.
In the slots table there are 2 fields, one called Week (which hold the Monday date for each week in the year), the other called Available (in this field we want to manually enter a number that will tell the system how many dispatches we can do that week). We want to automatically take the number from the Slots.Available and enter X number of blank records in the Dispatch table with the monday date.
How can this be done?
Then we will create a form that can be filled in with the balance of the information.
Thanks

View 3 Replies View Related

Insert Into Table

May 11, 2006

On the creation of a reconrd in the main table I'm trying to auto fill a sub table with standard information for the user. This is what I'm using to insert into the sub table:

db.Execute "INSERT INTO tblHistologySlides (HistID, HistSlide, HistEntBy) VALUES (" & Me.HistAutoNo & ", " & Me.Text58 & ", " & Me.HistEntBy & ")"

It's stepping through the code without problem but the data isn't going into the table.

Any ideas where I'm going wrong?

Thanks

D

View 3 Replies View Related

How To Get Name From Table And Insert It As ID To Another

Mar 8, 2014

I have an access database that contain 2 tables and 1 form :

table1 named customers (custid-custname)
table2 named sales(salesid-custid)
form named form1 contain (salesid-custid)
*note:in form1 custid is combobox

What i need is when i select an customer from combobox the column custid in sales table get custid not custname

I use this sql statement to get combobox items from customers table

Code:
SELECT Cust.[Cust-Name] FROM Cust;

View 1 Replies View Related

May I Insert A Record Into The Top Of A Table?

Nov 4, 2004

May I insert a record into the top of a table?
Please help me! Thanks very much!
My email: jokelogpop@yahoo.ca

View 9 Replies View Related

Insert Dates Into Table

Mar 13, 2006

Hello,
I have a table with 2 fields - WeekID(autonumber) and WDATE(date/time). What I want to be able to do is to enter a value for the first date and then have the next 25 entries automatically entered. Each entry is to be 1 week greater than the previous entry. Ultimately giving me a list of dates, numbered 1-26, incremented weekly.
I assume the DATEADD function is to be used but i cannot determine how.
Any help / pointers is greatly appreciated.
Thanks

View 2 Replies View Related

Insert Values From Same Table

Jan 18, 2007

Hi
I am creating an employee db, with fields including employeeID, surname, firstname, partnerSurname, partnerFirstname, partnerID. As some partners work at the company, I want the partnerID to list (thorugh a value box) employeeID's that match surname to a partnerSurname and firstname to partnerFirstname.
Is this possible? Any help greatly appreciated.
Thanks in advance.

View 1 Replies View Related

How Do I Insert Data From One Table To Another?

Mar 7, 2007

I want to set my insert such that

Insert into tableA (x,y,z) = (SELECT x,y,z FROM tableB)
WHERE NOT EXISTS (select x,y FROM tableA,tableB WHERE tableA.x = tableB.x AND tableA.y = tableB.y)

Basically I want to insert data in tableA from tableB if it does not exist in tableA yet.

Access says I'm not writing an updateable query.

View 1 Replies View Related

Insert Records From One Table To Another

Apr 10, 2007

hi, i want to convert some below mentioned format into msaccess tables.

the exact scenario is that i have some text files from old applicaiton (pascal based) which is no longer working due to hardware compatibility problem...

which has generated some text files under below mentioned format...

[CLIENT]
L1_CUSTOMER_REFERENCE=AbreyCatherine
L1_TITLE=Ms
L1_SURNAME=Abrey
L1_FORENAME=Catherine
L1_DOB=1 Jul 1957
L2_DOB=9 Jul 1954
L1_ADD1=165 Downhills Way
L1_ADD2=Tottenham
L1_ADD3=London
L1_PCODE=N17 6AH
Q_L1_SEX=F
L1_CLCODE=CA1
L1_MSTATUS=M
L1_RELIGION=Christ.
L1_HASPARTNER=Y
L1_PARTNERNAME=Gian Paolo Caddeo
L1_PHONEH=0181 889 3870
L1_SALUTATION=Catherine
L1_OCC=Management Consultant
L1_EMP_STAT=S
L1_HEALTH=G
L1_SMOKE=Y
L1_NATIONALITY=British
L1_NRA=60
L2_OCC=Heating Engineer
L2_EMP_STAT=S
L2_HEALTH=G
L2_SMOKE=N
L2_NATIONALITY=Italian
L2_NRA=65
FactFindDate=30 Oct 98
TermsOfBusDate=30 Oct 98
LastVisitDate=18 Oct 95
LastLetterDate=14 Dec 99
Consultant=KP
AdminRef=AT
BestCallTime=Evenings
ClientType=UKCL
L1_WillDate=1993
L2_WillDate=1993
MailAllowed=-1
LastMailDone=0
L1_NINumber=YZ070258B
SeparateTax=
ContactFrequency=26
ManualSelect=
ClientLastUpdated=29 Jun100
[CLIENT]

each and every record starts from [CLIENT] and First part is the field and the part " = " is the value for the respective field.

now, i need help in converting that information into msaccess tables and its respective values...

like ...1) first part will become the field of table and
2) 2nd part after " = " will be the value for the respective field of the respective table.

i hope that this has given clear picture. where i want help from an expert...so, kindly help me. That will be great indeed to me.. thanking yours...om

View 9 Replies View Related

Insert Into Existing Table

Feb 20, 2008

I have a table which contains the following fields:
WORKER,SUB SYS,JAN-08,FEB-08,MAR-08
I want to insert into this table each month the data from the second table for that month
can someone tell me how to do this...each time I try the secnd table data TOTAL strarts a new row below the ones that are already there...hard to explain. I tried this and it didn't work:

INSERT INTO [ORACLE SORA ALERTS BY WORKER] ( [JAN-08] )
SELECT A.TOTAL
FROM A INNER JOIN [ORACLE SORA ALERTS BY WORKER] ON (A.SYS = [ORACLE SORA ALERTS BY WORKER].[SUB SYS]) AND (A.WORKER = [ORACLE SORA ALERTS BY WORKER].WORKER);

WORKER SUB SYS JAN-08 FEB-08 MAR-08
0000A CRT
0000A ENF
0000A FIN
0000A RAP
000AT CRT
000AT ENF
000AT FIN
000AT RAP
000AX CRT
000AX ENF
000AX FIN
000AX RAP
I have a second table which contains the following fields:
WORKER,SYS,TOTAL

WORKER SYS TOTAL
0000A CRT 1
0000A FIN 21
000AX CRT 1
000AX ENF 2
000AX FIN 11

What I want is to move the numbers in the TOTAL COLUMN INTO THE MONTH/YEAR COLUMS IN THE FIRST TABLE. Would look something like this:

WORKER SUB SYS JAN-08 FEB-08 MAR-08
0000A CRT 1
0000A ENF
0000A FIN 21
0000A RAP
000AX CRT 1
000AX ENF 2
000AX FIN 11
000AX RAP

View 1 Replies View Related

Insert Into Existing Table

Feb 23, 2008

When I run this query I want the data inserted into an existing table in the correct place. It is inserting the data in the correct column but not the correct rows. Please see attached screenshot. Can you please show me what I'm doing wrong.

INSERT INTO UNDISTRIBUTED ( Jun2003 )
SELECT Sum(CCur(a.AMT_TO_DISTRIBUTE)) AS AMOUNT
FROM NOLDBA_RECEIPT AS a, NOLDBA_INT_CASE_STATUS AS b
WHERE (((Trim([a].[id_case])) Is Not Null) AND ((a.ID_CASE)=[b].[case_id]) AND ((a.CD_STATUS_RECEIPT)='H') AND ((a.DT_END_VALIDITY)=#12/31/9999#) AND ((Exists (select 1 from NOLDBA_RECEIPT k where a.dt_batch=k.dt_batch and a.no_batch=k.no_batch and a.cd_source_batch=k.cd_source_batch and a.seq_receipt=k.seq_receipt and k.ind_backout ='Y' and k.dt_end_validity =#12/31/9999#))=False)) OR (((Trim([a].[id_case])) Is Null) AND ((a.CD_STATUS_RECEIPT)='H') AND ((a.DT_END_VALIDITY)=#12/31/9999#) AND ((Exists (select 1 from NOLDBA_RECEIPT k where a.dt_batch=k.dt_batch and a.no_batch=k.no_batch and a.cd_source_batch=k.cd_source_batch and a.seq_receipt=k.seq_receipt and k.ind_backout ='Y' and k.dt_end_validity =#12/31/9999#))=False) AND ((b.CASE_ID)=(select min (y.case_id) from NOLDBA_INT_CASE_STATUS Y, NOLDBA_INT_CASE_MEMBER Z WHERE A.ID_PAYOR=Z.MEMBER_ID AND Z.RELATION_CODE IN ('A','P') AND Z.CASE_ID=Y.CASE_ID)))
GROUP BY b.IV_D_DO_CODE
ORDER BY b.IV_D_DO_CODE;

View 4 Replies View Related

Insert The Value From A Txtbox Into A Table

Sep 15, 2005

Hi there

Can someone give me a basic example.

I have a form that contains a textbox and a listbox. The listboxs rowsource is tblSPNZ.
The table has 2 fields 1 is and autonumber and the other is where I want the results to go.

How do I make a command button populate the table? Avoiding putting any results into the autonumber field?


Thank you for your help.

View 11 Replies View Related

Insert Automatic Value In A Table

Oct 20, 2006

HI,
Is it possible to save data in a table, just doing a check on the value of a combobox?

I need to insert a Num_CC value that I got from a table called TB_ANAGRAIFCA, in the table called TB_ALLEGATI. But the value of Num_CC depends on the value selected in a combo box. So I have to save the Num_CC related to the Provider selected in the combobox namade Nome_Provider.


Any suggestion?

I tried to draw in the form interested a textbox invisible, but I don't know how to retrieve the data.
Please, HElp me ....

Thanks,
Antonio.

View 1 Replies View Related

Create Table And Insert Into...

Jan 24, 2005

Hi
I've got two queries:
1.
create table oversikt
(
ansatt_nr number not null,
first_name text Null)

And
2.
INSERT INTO oversikt ( ansatt_nr, first_name )
VALUES (777, 'Andrew');

Is it possible to combine these in one query?

eroness

View 2 Replies View Related

VBA - Insert A Record From One Table To Other?

Aug 15, 2014

In my VBA code, i am trying to move some table records from table1 to table2. Both table1 and table2 has exact structures.

In the INSERT statement for table2, what is the easy way to insert a record from table1? I am trying to avoid having to specify each field name in the INSERT statement. Because, i have 100 fields in table.

Is there a way to INSERT a particular record from table1 to table2 without having to specify field names in the INSERT statement like in below example?

INSERT INTO Employees " _
& "(FirstName,LastName, Title) VALUES " _
& "('Harry', 'Washington', 'Trainee');"

View 1 Replies View Related







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