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 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 :: 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

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

Insert Table Records Into Another Table

Mar 5, 2008

I have this query below:

INSERT INTO TEST_DOC
SELECT *
FROM MPI_ADDSS_IFF;

I currently have 10 tables in my database (All with the same colunm names and formats) however i want to click a button that will put all the tables into TEST_DOC, instead of doing it one by one. To do this this i would like some code either in SQL or VBA that will do this.

Any ideas or help?

Kind Regards
Hewstone999

View 1 Replies View Related

How To Insert Images In Access Table

Nov 15, 2007

Hi all,

I am using Microsoft Access 2002. I would like to know how to insert images in Access table and retreive those data & images using Report.

I did change filed as OLE object. And try to insert object.

But I doesn't show at report.

Is there any other way to insert images in the table?

Please kindly help me.

View 3 Replies View Related

Insert A Multiple Selection Into A Table

Mar 23, 2008

This is probably in the wrong forum, but I'm not sure what area the answer would cover, either queries, macros, VBA etc.

I have a form, on which is a listbox with multiple selection enabled getting it's data from a query. What I want to do is for the user to be able to select multiple products from the listbox and have some VBA code or query concatenate each id and insert them into a table, separated by commas so I can separate them again for reports etc.

Eg.

Listbox:
ID
1
2
3

User selects 1 and 2 and clicks submit. Selections are concatenated to 1,2 and inserted into the table.

Please bear in mind I'm not the best at this kind of advanced databasing, so a simple or at least easy to follow answer would be very appreciated.

Thank you all in advance.

Steve

View 8 Replies View Related

Cannot Insert A Null Value Into Table Record

May 2, 2007

Using the sql profiler gives me no clue.

This is the insert query from the profiler.



exec sp_executesql N'INSERT INTO "ENVIS_GSD".."wat_springflow" ("result_dt","site_id","result_va","remark_tx") VALUES (@P1,@P2,@P3,@P4,@P5,@P6)', N'@P1 datetime,@P2 int,@P3 float,@P4 nvarchar(4),@P5 varchar(3),@P6 datetime', 'Feb 10 2009 12:00:00:000AM', 3000723, 8.000000000000000e-001, N'test'



The two records that I get the proplem on are not included here, but somehow they have been updated. I traced the access code, but I could see no reference to them that they were used for the update in either the form or any modules called.

Somehow up to a few weeks ago those two columns were updated.

Tracing the code and using the immediate window the user_name variable stores the login name corectly.

Someone mentioned "error 28" any ideas?

Thanks in advance

View 1 Replies View Related

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

Insert Data From Queries To A Table

Apr 29, 2008

Is it possible to select some data in queries in the same db to a table?

Many thanks!

View 3 Replies View Related

Insert Form Variable Into Table

Apr 7, 2005

Hi
I have a form that displays line items and their cost. At the bottom of the form I have a text field called text17 that uses a sum to total the value of all the line item costs with this : =Sum([Line Cost])

How would I pass that value into a database table?

View 14 Replies View Related







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