larrydavid
Programmer
Hello, I have a DLookup function which is returning a "Milestone" value which I am trying to display as a Y or N instead of 1 or 0. Below is the txtWBSMilestone field, the first line which is the original that works, the second which has the IIF statement I am using to try and return an Y/N value:
Private Sub Form_Open(Cancel As Integer)
Dim strKey As String
With Me
If Not IsNull(Me.numWBSLink) Then
strKey = DLookup("Key", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
!txtWBSMilestone = DLookup("Milestone", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
'!txtWBSMilestone = DLookup("IIf ([Milestone] = True,'Y','N') AS Milestone", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
End If
End With
End Sub
Here is the error I get when trying to go back an edit the form:
Run-time error '3075':
Syntax error (missing operator) in query expression 'IIF([Milestone] = True, 'Y','N') AS Milestone'.
Is what I'm trying to do even possible within a DLookup function?
Thanks,
Larry
Private Sub Form_Open(Cancel As Integer)
Dim strKey As String
With Me
If Not IsNull(Me.numWBSLink) Then
strKey = DLookup("Key", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
!txtWBSMilestone = DLookup("Milestone", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
'!txtWBSMilestone = DLookup("IIf ([Milestone] = True,'Y','N') AS Milestone", "tbl_StepbyStep", "[RecID] =" & Me.numWBSLink)
End If
End With
End Sub
Here is the error I get when trying to go back an edit the form:
Run-time error '3075':
Syntax error (missing operator) in query expression 'IIF([Milestone] = True, 'Y','N') AS Milestone'.
Is what I'm trying to do even possible within a DLookup function?
Thanks,
Larry