Groups | Search | Server Info | Login | Register
Groups > comp.databases.ms-access > #14405
| Newsgroups | comp.databases.ms-access |
|---|---|
| Date | 2021-11-18 09:22 -0800 |
| References | <411217df-e1c1-47a9-b09c-a79ef07f80dfn@googlegroups.com> |
| Message-ID | <d48796c1-4861-4e7f-84f9-094b5ec8d550n@googlegroups.com> (permalink) |
| Subject | Re: Passing a variable to SQL |
| From | Ron Paii <ron81pai@gmail.com> |
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 | Next — Previous in thread | Find similar
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