Groups | Search | Server Info | Login | Register


Groups > comp.databases.ms-access > #14405

Re: Passing a variable to SQL

X-Received by 2002:a05:620a:1294:: with SMTP id w20mr23414506qki.197.1637256123672; Thu, 18 Nov 2021 09:22:03 -0800 (PST)
X-Received by 2002:a54:4f82:: with SMTP id g2mr8662129oiy.134.1637256123095; Thu, 18 Nov 2021 09:22:03 -0800 (PST)
Path csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups comp.databases.ms-access
Date Thu, 18 Nov 2021 09:22:02 -0800 (PST)
In-Reply-To <411217df-e1c1-47a9-b09c-a79ef07f80dfn@googlegroups.com>
Injection-Info google-groups.googlegroups.com; posting-host=65.30.79.18; posting-account=RurhpQoAAACBjKrwaxvElRMdPO3AZiPP
NNTP-Posting-Host 65.30.79.18
References <411217df-e1c1-47a9-b09c-a79ef07f80dfn@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <d48796c1-4861-4e7f-84f9-094b5ec8d550n@googlegroups.com> (permalink)
Subject Re: Passing a variable to SQL
From Ron Paii <ron81pai@gmail.com>
Injection-Date Thu, 18 Nov 2021 17:22:03 +0000
Content-Type text/plain; charset="UTF-8"
Lines 18
Xref csiph.com comp.databases.ms-access:14405

Show key headers only | View raw


On Tuesday, November 16, 2021 at 2:28:33 PM UTC-6, Ray Pearson wrote:
> I have the following code - 
> 
> Dim varx As String 
> 
> varx = DLookup("[SubYear]", "[tblConfiguration]") 
> 
> Set db = CurrentDb() 
> 
> strSql = "SELECT FarNorth.JPID, FarNorth.FirstName, FarNorth.Surname, FarNorth.Email, FarNorth.Status, FarNorth.MOJNo, Sub2.SubID, Sub2.SubYear, Sub2.AmountPaid " & _ 
> "FROM FarNorth INNER JOIN Sub2 ON FarNorth.JPID = Sub2.SubID " & _ 
> "WHERE (((FarNorth.Status)='Active') AND ((Sub2.SubYear)= varx) AND ((Sub2.AmountPaid)Is Null) AND ((Len([FarNorth].[Email]))>0));" 
> 
> What am I doing wrong? varx is actually a Year eg 2022. 
> 
> TIAA - Ray

((Sub2.SubYear)=" &  varx & ")

Back to comp.databases.ms-access | Previous | NextPrevious in thread | Find similar


Thread

Passing a variable to SQL Ray Pearson <rwpearson123@gmail.com> - 2021-11-16 12:28 -0800
  Re: Passing a variable to SQL Ron Weiner <rw@domain.com> - 2021-11-16 17:17 -0500
  Re: Passing a variable to SQL Ron Paii <ron81pai@gmail.com> - 2021-11-18 09:22 -0800

csiph-web