tractorvix
Technical User
I know this has a really simple solution, but my brain just seems to have gone on holiday this afternoon. I've built a form which, through the use of combo boxes, builds up a product code. Before I add this new product to the list I would like to check if it already exists. I've set up a query, which shows if there is a record match but I'm not sure how to put this into the form so I can run the appropriate if statement. Ideally I would like something that does something like:
recordmatch = "SELECT [tbl-ProdID].[Product full Name]"&_
"FROM [tbl-ProdID]"&_
"WHERE ((([tbl-ProdID].[Product full Name])=[Forms]![frm-addproduct]![shortname]));"
if count of recordmatch is 0 then
add new record
else
msgbox "already exists"
end if
the product shortname is built based on the input from the combo boxes selected on the form.
Any help would be amazing!
Thanks
recordmatch = "SELECT [tbl-ProdID].[Product full Name]"&_
"FROM [tbl-ProdID]"&_
"WHERE ((([tbl-ProdID].[Product full Name])=[Forms]![frm-addproduct]![shortname]));"
if count of recordmatch is 0 then
add new record
else
msgbox "already exists"
end if
the product shortname is built based on the input from the combo boxes selected on the form.
Any help would be amazing!
Thanks