Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: sql insert statement


Message #1 by "Abraham Luna \(Attilanet.com\)" <abe@a...> on Thu, 12 Dec 2002 13:55:12 -0500
i changed the settings on the table so there is no primary key and no
required fields and the statement works fine. all the fields are text types.


----- Original Message -----
From: "Peter N. Kipe" <pkipe@c...>
To: "professional vb" <pro_vb@p...>
Sent: Thursday, December 12, 2002 3:32 PM
Subject: [pro_vb] RE: sql insert statement


> I took the liberty of reformatting the SQL statement VB code to make it
> easier for me to see:
>
> Dim strSQL As String
>
>     strSQL = _
>         "INSERT INTO Properties (" & _
>         " ClientID," & _
>         " REONumber," & _
>         " StreetNumber," & _
>         " Street," & _
>         " City," & _
>         " State," & _
>         " Zip," & _
>         " Status," & _
>         " VendorID) " & _
>         "VALUES (" & _
>         "'" & strClientID & "'," & _
>         "'" & strREONumber & "'," & _
>         "'" & strStreetNumber & "'," & _
>         "'" & strStreet & "'," & _
>         "'" & strCity & "'," & _
>         "'" & strState & "'," & _
>         "'" & strZip & "'," & _
>         "'" & strStatus & "'," & _
>         "'" & strVendorID & "')"
>
> If this is right, and if all the fields on the database are Text fields
(not
> Number type), then I'm at a loss for what's wrong.  Are ClientID, VendorID
> and Zip all Text fields on the database?
>
> Pete
>
> -----Original Message-----
> From: Abraham Luna (Attilanet.com) [mailto:abe@a...]
> Sent: Thursday, December 12, 2002 3:16 PM
> To: professional vb
> Subject: [pro_vb] RE: sql insert statement
>
>
> the autonumber column is already excluded. its called PropertyID
>
> ----- Original Message -----
> From: "Peter N. Kipe" <pkipe@c...>
> To: "professional vb" <pro_vb@p...>
> Sent: Thursday, December 12, 2002 2:05 PM
> Subject: [pro_vb] RE: sql insert statement
>
>
> > Assuming ClientID is the AutoNumber column, remove it from the INSERT
INTO
> > statement.  Access will take care of it without being told.
> >
> > Pete
> >
> > -----Original Message-----
> > From: Abraham Luna (Attilanet.com) [mailto:abe@a...]
> > Sent: Thursday, December 12, 2002 1:55 PM
> > To: professional vb
> > Subject: [pro_vb] sql insert statement
> >
> >
> > i have an access database. the properties table has an autonumber column
> > that is the primary key. inserting a new record, i do not want to
specify
> an
> > integer for this column because access handles it. my insert statement
> looks
> > like this:
> >
> > INSERT INTO Properties (ClientID, REONumber, StreetNumber, Street, City,
> > State, Zip, Status, VendorID) VALUES ('" & strClientID & "', '" &
> > strREONumber & "', '" & strStreetNumber & "', '" & strStreet & "', '" &
> > strCity & "', '" & strState & "', '" & strZip & "', '" & strStatus & "',
> '"
> > & strVendorID & "')
> >
> > i get an error message stating that i cannot have nulls for the
autonumber
> > column. what setting am i supposed to change on the access database for
> this
> > statement to work and have access handle the autonumbering?
> >
> >
> >
> >
>
>
>
>
>


  Return to Index