Help with If/Else

ncraigg

Registered User.
Local time
Yesterday, 19:32
Joined
Jun 2, 2011
Messages
17
I'm developing a web database in Access 2010 and I'm having a bit of trouble with a data macro. I'm trying to find a workaround for the lack of 'sum' functions (specifically the 'last' criterion) available in the web queries, and came across a post that discusses creating a new table to hold the last entered record for a particular ID (for discussion, I'll call the table tblLastEntry) by using data macros to update the selected record each time a new entry is made into the main table.

I've got the portion of my data macro that updates the record in tblLastEntry working properly. The part that I'm having trouble with is creating a new record in tblLastEntry if a record for the ID that I'm working with doesn't already exist. It seems to me that it should somehow use the If/Else function, but I'm not sure what the syntax should be.

What I've got so far is:

Parameters:
[prmID]
[prmStatus]

LookUpRecord: tblLastEntry
WhereCondition: [prmID] = [ID]

If: (this is where I'm having trouble. Is there a way to say 'no record found?)
Then:
CreateRecord: in tblLastEntry
SetField:
- Name = [ID]
- Value = [prmID]
SetField
- Name = [Status]
- Value = [prmStatus]

Else:
EditRecord:
SetField:
- Name = [ID]
- Value = [prmID]
SetField
- Name = [Status]
- Value = [prmStatus]

End EditRecord

EndIf

Thanks in advance for your help!
 

Users who are viewing this thread

Back
Top Bottom