Put a space in Sql

J

JEBF

Hi I have this code in a Form's Load event, it's working
the thing that I want to do is put a space between the
fields [Nombre] and [ApeidoPaterno] If I put & " & " "
& " & instead of & send me a error 3075.

Thank in advance



Dim StrRecordKit As String

StrRecordKit = " SELECT TblKit.IdKit AS ID, [Nombre] &
[ApeidoPaterno] & [ApeidoMaterno] & [NumeroCelularAct]
AS Datos FROM TblKit"

Me.RecordSource = StrRecordKit
 
J

John Vinson

Hi I have this code in a Form's Load event, it's working
the thing that I want to do is put a space between the
fields [Nombre] and [ApeidoPaterno] If I put & " & " "
& " & instead of & send me a error 3075.

Thank in advance



Dim StrRecordKit As String

StrRecordKit = " SELECT TblKit.IdKit AS ID, [Nombre] &
[ApeidoPaterno] & [ApeidoMaterno] & [NumeroCelularAct]
AS Datos FROM TblKit"

Me.RecordSource = StrRecordKit

The problem is that you're trying to put " inside a string delimited
by ". In order to do so, use two consecutive " characters:

StrRecordKit = " SELECT TblKit.IdKit AS ID, [Nombre] & "" "" &
[ApeidoPaterno] & "" "" & [ApeidoMaterno] & "" "" & [NumeroCelularAct]
AS Datos FROM TblKit"

Or, use the ASCII code for a blank: Chr(32).
 
G

Guest

John, thank again, is working
-----Original Message-----
Hi I have this code in a Form's Load event, it's working
the thing that I want to do is put a space between the
fields [Nombre] and [ApeidoPaterno] If I put & " & " "
& " & instead of & send me a error 3075.

Thank in advance



Dim StrRecordKit As String

StrRecordKit = " SELECT TblKit.IdKit AS ID, [Nombre] &
[ApeidoPaterno] & [ApeidoMaterno] & [NumeroCelularAct]
AS Datos FROM TblKit"

Me.RecordSource = StrRecordKit

The problem is that you're trying to put " inside a string delimited
by ". In order to do so, use two consecutive " characters:

StrRecordKit = " SELECT TblKit.IdKit AS ID, [Nombre] & "" "" &
[ApeidoPaterno] & "" "" & [ApeidoMaterno] & "" "" & [NumeroCelularAct]
AS Datos FROM TblKit"

Or, use the ASCII code for a blank: Chr(32).




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top