![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I’m trying to make a conditional macro that will check a table to make sure there isn’t already a record with the same ID and Entry #. If there is a record, it should give you a message box warning of duplicate entry. If there isn’t any returned values then it should run an append query. So conceptually speaking If Query1 > 0 then Error Message: “Already entered” If Query1 Is Null then AppendQuery Query 1: (SELECT Count(Tbl_Assessment.ID) AS CountOfID FROM Tbl_Assessment WHERE (((Tbl_Assessment.Entry)=1)) GROUP BY Tbl_Assessment. ID, Tbl_Assessment.Entry, [Forms]![Form1]! [ID] ![]() AppendQuery: INSERT INTO Tbl_Assment ( Trial, ID ) SELECT Tbl_Lookup.Lookup_Value, [Forms]![Form1]![ID] AS ID FROM Tbl_Lookup WHERE (((Tbl_Lookup.Group)=52)); How would I go about doing this in a macro? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
For anyone who runs across this in the future I was passing the form values to the DCount function and was having problems it not working. You need to check the quoting which is explained here: http://allenbrowne.com/ser-66.html In reality, do you really nead a "group by" query? |
![]() |
| Thread Tools | |
| Display Modes | |
| |