Put a space in Sql

  • Thread starter Thread starter JEBF
  • Start date Start date
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
 
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).
 
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).




.
 
Back
Top