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 & ")"

Recommended Answers

All 4 Replies

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.

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 & ")"

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 & ")"

thanks, I must have forgotton the later [ marks.

cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.