Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Save Notes < Email Report | Case Sensitive >
Back to Save Notes    Comments List
INSERT INTO Error 3075 Upload Images   Link   Email  
Mara Lucic       
30 days ago
Hi,

I have an issue with "Description" text field when added to INSERT INTO code. For example i have another text filed "SerialNum" that is working fine saving its value in the history table, but when i add Description field it's causing error 3075. Both tables have same settings for this text field, field names match and i can't see what the issue is. Here is my code.

Thanks


Private Sub Command10_Click()

CurrentDb.Execute "INSERT INTO OrderDetailT ( InventoryID, OrderID, Price, SerialNum, Description, RentalStart, RentalEnd ) " & _
" VALUES (" & InventoryID & ", " & CurrentOrderID & "," & Price & ", """ & SerialNum & """, """ & Description & """, #" & CurrentRentalStart & "#, #" & CurrentRentalEnd & "#)"

Me.Refresh

End Sub
Adam Schwanz             
30 days ago
What is error 3075? Is that the syntax error?

Start by removing the & _ line break and see if that helps, put it all on one line and see if you get anything different, I've had sql statements not work in the past because of where I broke it in the statement.
Sami Shamma               
30 days ago
What I do is this:
Private Sub Command10_Click()

    Dim InsertString as String
    Dim ValueString As String

    InsertString =  "INSERT INTO OrderDetailT ( InventoryID, OrderID, Price, SerialNum, Description, RentalStart, RentalEnd ) "
    MsgBox InsertString

    ValueString = " VALUES (" & InventoryID & ", " & CurrentOrderID & "," & Price & ", """ & SerialNum & """, """ & Description & """, #"
    & CurrentRentalStart & "#, #" & CurrentRentalEnd & "#)"
    MsgBox ValueString

    CurrentDb.Execute InsertString & ValueString

    Me.Refresh

End Sub


Check the two strings for errors
Richard Rost             
30 days ago
Does your description field data by chance have any quotes " in it?
Mara Lucic       
29 days ago
Thanks Sami and Richard! Yes, my description has " for inches. Should i replace " with word inch or is there a way to leave them in?
Kevin Robertson             
29 days ago
Sami Shamma               
29 days ago
Mara

Replacing it will work

There is a more sophisticated method to do that if you are interested

Escape Double Quotes
Sami Shamma               
29 days ago
Kevin beat me to it. :)
Richard Rost             
29 days ago
That's always a problem when writing SQL statements as strings. You could also switch to using a Recordset.
Add a Reply Upload an Image

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/13/2024 11:05:43 PM. PLT: 1s