sql into vba

  • Thread starter Thread starter johnny
  • Start date Start date
Hi,


From the query designer, switch in SQL view. Select the whole code, from
the keyboard, make Ctrl_C. Go in you VBA module, where you want to paste the
code, do it with Ctrl_V. It is possible that the code will be in red,
because it is not a valid VBA statement, it is a SQL statement. You have to
use delimiter, generally ", around it to make it as text, and use it in an
appropriate context, like

CurrentDb.Execute " UPDATE ... "

or like

Set rst=CurrentDb.OpenRecoreset("SELECT ... ")


Hoping it may help,
Vanderghast, Access MVP
 
Hi,


I would try changing the No by 0 (zero). Have you dim the
variable recordset (you are using option explicit? ) as


Dim rst As DAO.Recordset


in the declaration part of the form ( before any line of subroutine,
after the Option Database and Option Explicit ) .



Hoping it may help,
Vanderghast, Access MVP


Hello
Vanderghast, Access MVP

I have tray vat you have told me to do
but it issent kom some data out
kan you tell me vay
sory my englisch



Private Sub liste21_GotFocus()
Set rst = CurrentDb.OpenRecordset("SELECT [LAGER
VARER].ORDREGIVER, [LAGER VARER].AFSENDER, [LAGER
VARER].TILBRINGER, [LAGER VARER].MÆRKNING, [LAGER VARER].
[FISKEART/STØRELSE], [LAGER VARER].ANTAL, [LAGER VARER].
[FRYS/FERSK], [LAGER VARER].DATO, [LAGER
VARER].BEMÆRKNING, [LAGER VARER].UDGÅET FROM [LAGER VARER]
WHERE ((([LAGER VARER].UDGÅET)=No));")

End Sub
 
Back
Top