Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   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
Upload Images   @Reply   Bookmark    Link   Email  
INSERT INTO Error 3075
Mara Lucic 
    
12 months 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  @Reply  
             
12 months 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  @Reply  
              
12 months 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  @Reply  
          
12 months ago
Does your description field data by chance have any quotes " in it?
Mara Lucic OP  @Reply  
    
12 months 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  @Reply  
           
12 months ago
Sami Shamma  @Reply  
              
12 months ago
Mara

Replacing it will work

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

Escape Double Quotes
Sami Shamma  @Reply  
              
12 months ago
Kevin beat me to it. :)
Richard Rost  @Reply  
          
12 months ago
That's always a problem when writing SQL statements as strings. You could also switch to using a Recordset.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Save Notes.
 

 
 
 

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 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/12/2025 9:04:50 PM. PLT: 1s