1. your photo is incomplete, we cant see it all
2. it looks like you have too many parameters
Dlookup([field], [table/query], "where clause")
Thank you ranman256, does this look ok to you ? the Line1 is set to string, RecNo is RecordNumber set as Number [Acorn] [EmailConversation] etc is a yes/no field
It is Line1 that causes the problem
Code:RecNo = DLookup("RecordNo", "tblReplies", "[Acorn] = Yes" & " And [Curved] = Yes" & " And [SpokenTo] = Yes" & " And [EmailConversation] = Yes" & " And [TooOld] = Yes") Me.txtRecNo = RecNo IntroLine = TOD & DLookup("IntroLine", "tblReplies", "[RecordNo] = " & RecNo) Line1 = DLookup("Line1", "tblReplies", "tblReplies", "[RecordNo] = " & RecNo)
RecNo = DLookup("RecordNo", "tblReplies", "[Acorn] = Yes And [Curved] = Yes And [SpokenTo] = Yes And [EmailConversation] = Yes And [TooOld] = Yes")
but I prefer:
RecNo = DLookup("RecordNo", "tblReplies", "[Acorn] = true And [Curved] = true And [SpokenTo] = true And [EmailConversation] = true And [TooOld] = true")
Understood but surely that would stop the DLookup on the Line1 would it ?? that is past that code, it doesn't appear to like the DLookup on that row
I will send and highlight the issue but of course i can easy Ctrl F to all Yes and change to True in the event
Code:RecNo = DLookup("RecordNo", "tblReplies", "[Acorn] = Yes" & " And [Curved] = Yes" & " And [SpokenTo] = Yes" & " And [EmailConversation] = Yes" & " And [TooOld] = Yes")Me.txtRecNo = RecNo IntroLine = TOD & DLookup("IntroLine", "tblReplies", "[RecordNo] = " & RecNo) Line1 = DLookup("Line1", "tblReplies", "tblReplies", "[RecordNo] = " & RecNo) LiftBody = DLookup("MailBody", "tblReplies", "[RecordNo] = " & RecNo) ClosingLine = DLookup("ClosingLine", "tblReplies", "[RecordNo] = " & RecNo)
You have Line1 = DLookup("Line1", "tblReplies", "tblReplies", "[RecordNo] = " & RecNo)
tblReplies twice !
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
You guy's are fab..... that done the trick, it's because I have been copying and pasting the code in and couldn't see the wood for the trees, works perfect.. thank you all
Maybe this site https://www.techonthenet.com/access/functions/ or one like it would be the go-to place next time. I think it would have been obvious had you gone there, but sometimes I can't see the forest for the trees...
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.