adding data from form to another table with check box yes/no

MITSupport

Registered User.
Local time
Today, 21:31
Joined
Aug 8, 2016
Messages
46
Hi all

I am trying to add information from a form created on table A to a table called Issues if a check box is ticked.

I have tried the following code:

Private Sub Issues_Click()

Dim strSQL As String

strSQL = "INSERT INTO Issues [(field1[, field2[, …]])] VALUES (value1[, value2[, …])"

DoCmd.RunSQL strSQL

End Sub


I dont know what I have done wrong but it is not adding the data and i am getting really frustrated :banghead:

Can some one please help me out \as I dont know what to do.

TIA

MITSupport
 
Yes JHB that is the string i have been trying to use straight out of the database.

Please tell me if i am doing it wrong.

TIA
 
Yeah okay, I see it is take direct from an explanation.
The below insert value 1 and 2 into table Issues, imagined it has 2 fields called "AFieldNameInIssues" and "AnOtherNameInIssues".
strSQL = "INSERT INTO Issues ([AFieldNameInIssues], [AnOtherNameInIssues]) VALUES (1,2);"
 
Oh Ok

So with the Issues table being the exact as the table that it is coming from with the same field names etc is there any easy way of adding the data (there is 22 Fields in each table that are all called the same name)

Also just as an after thought i was also wanting to add the table name it came from into the Issues table as a reference as well ( i know it is asking too much of my limited brain capacity lol)
 
Use the QBE to create your SQL-string, but to have 2 tables with the same structure and data isn't correct database setup.
You should take a step backward and read up on database normalisation.
 
Ok.....

So i would have to change the structure of the Issues table for it to work properly. The whole idea is to do a QA Compliance for Electrical Projects ( Cable QA ) hence the structure is all the same across all the tables.

So the the tables look like this: (if it will allow me to post a clip lol)

Field Name
ID
Rev
Drawing Reference
Drawing Reference 2
Cable Type
Prefix
Type
Cores
Cross Section mm2
Cable Type 2
Overall Diameter
Colour
Code (OLEX)
Approx Length
Origin Connection
Origin Zone
Origin Gland Thread
Destination Connection
Destination Zone
Destination Gland Thread
Installation Details
Cable Calculation
Comments
Issues (This is a Check Box that when ticked takes the data from this record and places it is the Issues table)
QA Hyperlink

Except for the Issues Table which takes out the QA Hyperlink and puts in the Table Name from where the issues comes from

TIA
 

Users who are viewing this thread

Back
Top Bottom