Checking if a record exists from a form button on update

%3CLINGO-SUB%20id%3D%22lingo-sub-2322518%22%20slang%3D%22en-US%22%3EChecking%20if%20a%20record%20exists%20from%20a%20form%20button%20on%20update%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2322518%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EI%20have%20a%20bit%20of%20a%20problem.%26nbsp%3B%20I%20have%20a%20form%20with%20a%20date%20dropdown%20combo%2C%26nbsp%3B%20%22WeekCommCombo%22.%20After%20update%20I%20am%20trying%20to%20check%20in%20the%20table%20to%20see%20if%20there%20is%20a%20record%20with%20the%20date%20already%20in%20the%20table.%20if%20there%20is%20then%20display%20one%20message%20and%20if%20there%20isn't%20display%20the%20message%20%22Run%20Query%22.%26nbsp%3B%20However%2C%20when%20I%20run%20it%20it%20does%20nothing.%26nbsp%3B%20Not%20even%20an%20error%20message.%26nbsp%3B%20(Code%20below)%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ajcbutler_0-1620144073033.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277916iF972CBD153D92E92%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ajcbutler_0-1620144073033.png%22%20alt%3D%22ajcbutler_0-1620144073033.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAny%20ideas%20what%20I%20can%20get%20this%20to%20work%3F%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EAaron%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2322518%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2322818%22%20slang%3D%22en-US%22%3ERe%3A%20Checking%20if%20a%20record%20exists%20from%20a%20form%20button%20on%20update%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2322818%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1044865%22%20target%3D%22_blank%22%3E%40ajcbutler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20SQL%20is%20looking%20for%20a%20DATE%20to%20match%20a%20DATE%20in%20the%20field%20%22Week_Commencing%22.%20That%20suggests%20a%20couple%20of%20possibilities.%3C%2FP%3E%3CP%3EOne%2C%20are%20the%20values%20in%20question%20actually%20DATES%2C%20or%20strings%20FORMATTED%20to%20look%20like%20dates.%20To%20the%20human%20eye%2C%20of%20course%2C%20they%20could%20appear%20to%20be%20the%20same%2C%20but%20to%20Access%20the%20Date%20DataType%20is%20different%20from%20the%20string%20datatype.%3C%2FP%3E%3CP%3ETwo%2C%20your%20SQL%20uses%20the%20string%20delimiter%2C%20which%20is%20the%20apostrophe%20'%20but%20you%20are%20trying%20to%20work%20with%20dates.%20so%20you'd%20want%20to%20use%20the%20date%20delimiter%20%23%20instead.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi

I have a bit of a problem.  I have a form with a date dropdown combo,  "WeekCommCombo". After update I am trying to check in the table to see if there is a record with the date already in the table. if there is then display one message and if there isn't display the message "Run Query".  However, when I run it it does nothing.  Not even an error message.  (Code below)

ajcbutler_0-1620144073033.png

Any ideas what I can get this to work?

Thanks

Aaron

1 Reply

@ajcbutler 

Your SQL is looking for a DATE to match a DATE in the field "Week_Commencing". That suggests a couple of possibilities.

One, are the values in question actually DATES, or strings FORMATTED to look like dates. To the human eye, of course, they could appear to be the same, but to Access the Date DataType is different from the string datatype.

Two, your SQL uses the string delimiter, which is the apostrophe ' but you are trying to work with dates. so you'd want to use the date delimiter # instead.