Christopher Hawkins
clh at christopherhawkins.com
Sun Sep 5 23:05:52 CDT 2004
HI, Darren. You have a few options. YOu can try this: appSQL = "INSERT INTO tblMyBookings ( BookingIDFromBookingsTable ) " _ & "SELECT '" & strMyValueAsAString & "' FROM tblMyBookings ;" Or this: appSQL = "INSERT INTO tblMyBookings ( BookingIDFromBookingsTable ) " _ & "SELECT " & Chr(34) & strMyValueAsAString & Chr(34) & " FROM tblMyBookings ;" Or, if you feel like writing a variable-wrapping function, even this: appSQL = "INSERT INTO tblMyBookings ( BookingIDFromBookingsTable ) " _ & "SELECT " & WrapVar(strMyValueAsAString,"text") & " FROM tblMyBookings ;" ---- Original Message ---- From: d.dick at uws.edu.au To: accessd at databaseadvisors.com, Subject: RE: [AccessD] (no subject) Date: Mon, 6 Sep 2004 13:35:54 +1000 >Hello all >I'm having a little trouble with the syntax of an append SQL string > >I am setting a string value in code based on a booking ID >I want to iterate through all the bookings - get the bookingID >and then Append it to a table. > >Pretty basic, but I can never get the correct 'encasing' of the >coded value right. EG where to use quotes, where to use ampersands >etc. >The code snip below is all cool except for the bit in the SQL where >it is >putting the coded value into the relevant field in the table, IE >after the >SELECT portion >of the SQL > >Can anyone tidy this up for me? > >Many thanks in advance > > >Dim strMyValueAsAString as string > > strMyValueAsAString = Me.BookingID > > appSQL = "INSERT INTO tblMyBookings ( >BookingIDFromBookingsTable >) " _ > & "SELECT " & strMyValueAsAString & " FROM tblMyBookings >;" > >Have a great day > >Darren > > >-- >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com > Respectfully, Christopher Hawkins Software Developer (559) 687-7591 http://www.christopherhawkins.com