On 23 sep, 20:11, John Spencer <JSPEN...@Hilltop.umbc> wrote:
> If it is a string then you need to add string delimiters.
>
> strSQL = "SELECT Country FROM trxn_leg" & _
> * * * * * *" WHERE [Transaction Reference Identifier] = '" &
> strTransactionID & _
> * * * * * *"' AND [Party Role] in ('SEND','RCV')"
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
>
>
> Ixtreme wrote:
> > On 23 sep, 14:41, John Spencer <JSPEN...@Hilltop.umbc> wrote:
>
> > I am facing a few problems with your code which I modified a bit. The
> > field [Transaction Reference Identifier] is a string, it contains text
> > (for example: "TRANS-2010-09-23_00000001")
>
> > However, if I run the code below, I get an error: Too few parameters.
> > Expected 1.
>
> > Public Sub fCheckCrossBorder(strTransactionID)
>
> > Dim rst As DAO.Recordset
> > Dim strSQL As String
>
> > Dim strCrossBorder As String
>
> > Dim strCountry1 As String, strCountry2 As String
>
> > strSQL = "SELECT Country FROM trxn_leg" & _
> > * * * * * " WHERE [Transaction Reference Identifier] = " &
> > strTransactionID & _
> > * * * * * " AND [Party Role] in ('SEND','RCV')"
>
> > strCrossBorder = Forms!FOT![Cross Border Transaction Indicator]
>
> > Set rst = CurrentDb().OpenRecordset(strSQL)
> > With rst
> > * * If .RecordCount > 0 Then
> > * * * *.MoveLast
> > * * * *If .RecordCount <> 2 Then
> > * * * * * Forms![FOT].Form![strInfo] = vbNullString
> > * * * *Else
> > * * * * * strCountry2 = .Fields(0)
> > * * * * * .MoveFirst
> > * * * * * strCountry1 = .Fields(0)
> > * * * * * If strCountry1 = strCountry2 And strCrossBorder = "Y" Then
> > * * * * * * Forms![FOT].Form![strInfo] = "Flag should be N"
> > * * * * * ElseIf strCountry1 <> strCountry2 And strCrossBorder = "N"
> > Then
> > * * * * * * Forms![FOT].Form![strInfo] = "Flag should be Y"
> > * * * * * Else
> > * * * * * * Forms![FOT].Form![strInfo] = vbNullString
> > * * * * * End If
> > * * * *End If
> > * * Else
> > * * * *Forms![FOT].Form![strInfo] = vbNullString
> > * * End If
> > End With
> > End Sub- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
Perfect.
Thanks John!
|