ms access 2013 - Dlookup string failing -
for reason can't dlookup function correctly keep getting errors. error data type mismatch.
option compare database private sub command131_click() docmd.setwarnings false if (nz(dlookup("lettersent1bool", "dbo_t_volunteers", _ "volunteerid = '" & me![volunteerid] & "'"))) > 0 msgbox "error ! volunteer has received letter ," else docmd.openquery "produceletterssixtotwelve", , acreadonly if dcount("*", "dbo_t_sixtotwelveweeks") > 0 msgbox "success ! please open mail merge template" else msgbox "error ! no records found" end if end if end sub
figured out, need remove quotes around & me![volunteerid]
option compare database private sub command131_click() docmd.setwarnings false if (nz(dlookup("lettersent1bool", "dbo_t_volunteers", _ "volunteerid = " & me![volunteerid]))) > 0 msgbox "error ! volunteer has received letter ," else docmd.openquery "produceletterssixtotwelve", , acreadonly if dcount("*", "dbo_t_sixtotwelveweeks") > 0 msgbox "success ! please open mail merge template" else msgbox "error ! no records found" end if end if end sub
Comments
Post a Comment