SQL moving data error

Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Nov 2008
Posts: 19
Reputation: Swarv is an unknown quantity at this point 
Solved Threads: 0
Swarv Swarv is offline Offline
Newbie Poster

SQL moving data error

 
0
  #1
Dec 1st, 2008
Hi all,

I have this sql line (below) and where it works fine at the moment. But I have columns with 2 words i.e. opened by. I would like to add this colum to the statement below but everytime i try it errors. Do I have to reword the statement or use special quotes?

Thanks

Martin


SQLText = "INSERT INTO issues1 ([title], [time], [Opened], [staff], [status], [category], [comment]) SELECT title, time, Opened, staff, status, category, comment " & "FROM issues where (issues.id=" & Me.ID & ")"
Last edited by peter_budo; Dec 3rd, 2008 at 7:17 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 306
Reputation: timothybard is an unknown quantity at this point 
Solved Threads: 26
timothybard's Avatar
timothybard timothybard is offline Offline
Posting Whiz

Re: SQL moving data error

 
0
  #2
Dec 1st, 2008
Can you show us the statement that doesn't work? My first guess would be that you don't have brackets around each of the fields. I see you have brackets in the Insert INTO section of the SQL Statement, but not in the SELECT section of the statement.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: Swarv is an unknown quantity at this point 
Solved Threads: 0
Swarv Swarv is offline Offline
Newbie Poster

Re: SQL moving data error

 
0
  #3
Dec 1st, 2008
The statement above does work. I would have thought that the below would work. All I would do is place the column names in quotes.

SQLText = "INSERT INTO issues1 ("title", "time", "Opened", "opened by", "staff", "status", "category", "comment", "assigned to") SELECT title, time, Opened, opened by, staff, status, category, comment , assigned to" & "FROM issues where (issues.id=" & Me.ID & ")"
Last edited by peter_budo; Dec 3rd, 2008 at 7:18 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 306
Reputation: timothybard is an unknown quantity at this point 
Solved Threads: 26
timothybard's Avatar
timothybard timothybard is offline Offline
Posting Whiz

Re: SQL moving data error

 
0
  #4
Dec 1st, 2008
Try this:

SQLText = "INSERT INTO issues1 ([title], [time], [Opened], [opened by], [staff], [status], [category], [comment], [assigned to]) SELECT [title], [time], [Opened], [opened by], [staff], [status], [category], [comment] , [assigned to]" & "FROM issues where (issues.id=" & Me.ID & ")"
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: Swarv is an unknown quantity at this point 
Solved Threads: 0
Swarv Swarv is offline Offline
Newbie Poster

Re: SQL moving data error

 
0
  #5
Dec 1st, 2008
thanks, I must have forgotton the later [ marks.

cheers
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS Access and FileMaker Pro Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC