Programmatic SQL statement

  • Thread starter Thread starter George Papadopoulos
  • Start date Start date
G

George Papadopoulos

Hello everybody

I have written the code below :

Private Sub Anazhthsh_Click()
Dim strSelect As String

strSelect = "Select Kwdikos_episkeyhs, Kwdikos_klinikhs,
Kwdikos_mhxanhmatos FROM EPISKEYH WHERE Kwdikos_texnikou =" &
Me.Kwdikos_Texnikou.Value

MsgBox (Me.Kwdikos_Texnikou.Value)

[list_Episkeyes].RowSource = strSelect

End Sub

Table EPISKEYH contains a text field of length 4, named Kwdikos_texnikou.
Me.Kwdikos_texnikou.Value is supposed to be the value of a text box on my
form, inputed by the user.

The statement [list.Episkeyes].RowSource = strSelect does not select any
records (list_Episkeyes is a list box).

What am I doing wrong? Do I need to cast the value of the text box into
'text' type. Or something else?

Any help would be appreciated.

George Papadopoulos
 
Hi,
If it's text, you have to enclose it in quotes:
Kwdikos_mhxanhmatos FROM EPISKEYH WHERE Kwdikos_texnikou ='" & _
Me.Kwdikos_Texnikou & "'"

If the value is numeric, you don't need delimiters and if it's a date, you
delimit with #.

HTH
Dan Artuso, MVP
 
thx, Dan

I needed to add those quotes after all.

George Papadopoulos


Ï "dan artuso said:
Hi,
If it's text, you have to enclose it in quotes:
Kwdikos_mhxanhmatos FROM EPISKEYH WHERE Kwdikos_texnikou ='" & _
Me.Kwdikos_Texnikou & "'"

If the value is numeric, you don't need delimiters and if it's a date, you
delimit with #.

HTH
Dan Artuso, MVP

George Papadopoulos said:
Hello everybody

I have written the code below :

Private Sub Anazhthsh_Click()
Dim strSelect As String

strSelect = "Select Kwdikos_episkeyhs, Kwdikos_klinikhs,
Kwdikos_mhxanhmatos FROM EPISKEYH WHERE Kwdikos_texnikou =" &
Me.Kwdikos_Texnikou.Value

MsgBox (Me.Kwdikos_Texnikou.Value)

[list_Episkeyes].RowSource = strSelect

End Sub

Table EPISKEYH contains a text field of length 4, named Kwdikos_texnikou.
Me.Kwdikos_texnikou.Value is supposed to be the value of a text box on my
form, inputed by the user.

The statement [list.Episkeyes].RowSource = strSelect does not select any
records (list_Episkeyes is a list box).

What am I doing wrong? Do I need to cast the value of the text box into
'text' type. Or something else?

Any help would be appreciated.

George Papadopoulos
 
Back
Top