Selasa, 27 September 2011

[MS_AccessPros] Re: Insert Into Syntax help

 

John and Duane,

That was it! Thanks!! I seem to always have trouble getting the right combination of """"'s. but I'm getting better. <grin> I think...at least I keep telling myself that. LOL.

John, have you posted any pictures of Greece on your website? I always enjoy looking at your pictures.

Thanks again!!
Doyce

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> Doyce-
>
> I was off in Greece (actually, the island of Santorini) on vacation.
>
> Be sure to put a space between the table name and the list of fields:
>
> strSQL = "Insert INTO [WordsDrawn] (ID, Contestants) Values (" & intWDID & ",
> """ & strWord & """)"
>
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Duane Hookom
> Sent: Monday, September 26, 2011 11:55 PM
> To: Access Professionals Yahoo Group
> Subject: RE: [MS_AccessPros] Insert Into Syntax help
>
>
> Doyce,
> Try this:
> strSQL = "Insert INTO [WordsDrawn](ID, Contestants) Values (" & intWDID & ", """
> & strWord & """)"
> Debug.Print strSQL
>
> Duane Hookom
> MS Access MVP
>
>
>
>
> To: MS_Access_Professionals@yahoogroups.com
> From: winberry.doyce@...
> Date: Mon, 26 Sep 2011 20:44:10 +0000
> Subject: [MS_AccessPros] Insert Into Syntax help
>
>
>
>
>
>
> Hello friends!
>
> John Viescas, nice to see you posting. Hope you had a good time doing whatever
> you were off doing.
>
> I'm trying to capture a value from a form and a calculated value and save them
> into a table using Insert Into but can't seem to get the syntax correct. I've
> verified both values as working correctly through the immediate window, however
> I can't seem to save them in a table. The table has only 2 fields, ID and
> Contestant. I'm using the following code:
>
> 'Save word to WordsDrawn Table
> Dim intWDID As Integer
> Dim strWord As String
> Dim strSQL As String
>
> intWDID = Nz(DMax("ID", "WordsDrawn") + 1, 1)
> Debug.Print intWDID
>
> strWord = Me.txtName
> Debug.Print strWord
> strSQL = "Insert INTO [WordsDrawn](ID, Contestants) Values (intWDID, strWord)"
> Debug.Print strSQL
>
> Dim db As DAO.Database
> 'Point to this database
> Set db = CurrentDb
>
> CurrentDb.Execute strSQL, dbFailOnError
>
> When I execute this code I get a runtime error 3601: Too few parameters.
> Expected 2.
>
> I appreciate any help.
>
> Doyce
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar