Neo
Member
Registered: 20th Feb 07
Location: Essex
User status: Offline
|
Guy doing a project for a site has gone off on long term sick so I've decided to have a look and get my old access hat on, not touched it since 2003 so a lot has changed.
Apparently it can send emails using the new function "sendemail" which goes in a data macro in a table. The data macro is then run from a standard macro on button press/update etc
I've tried setting the data macro and at present I have
Look Up a Record In Users
Where Condition =[Issues].[Status]=[Users].[UserLevel] AND [Issues].[Depart_Name]=[Users].[Dep_Name]
Alias
SendEmail
To=[Users].[Email]
CC
BCC
etc
etc
However I get errors saying that the values haven't been set as parameters
So I create 4 Parameters
IssuesStatus
UserUserLevel
IssuesDepart_Name
UserDep_Name
Use these in place of the table & field names then define the parameters with the RunDataMacro action on my button.
I then Recieved an Error saying "[Users] does not exist"
The "To" field must refer to a field in a table from which the WHERE condition is obviously selecting the correct row.
Anything I'm missing ?
|
pow
Premium Member
Registered: 11th Sep 06
Location: Hazlemere, Buckinghamshire
User status: Offline
|
Urgh it's god awful. Is it populating the To: field properly?
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Either a row isn't being returned or the list of fields in the query doesn't contain To.
Echo the var and see what's in it instead of trying to send the mail.
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Although that error also looks like the table doesn't exist. Can you get any data out of it?
I would generally always echo the data coming back so I know what I have before passing it about. And run the query direct in to the DB so you can see how many rows come back.
Or do a COUNT(*) somewhere in there - not sure about the Access syntax - to see how many rows come back.
Or do a LIMIT 1 or DISTINCT or TOP 1 whatever it uses to make sure you only ever return one row. There doesn't appear to be anything in that query that will enforce uniqueness over the lifespan of the data. Unless it's doing some loopy stuff somewhere I can't see. Either way, it shouldn't really automatically send lots of email, aside from the spamming issue if that is waiting for the query to complete and there's a network element to the iteration that will slow the app down unacceptably.
|
Neo
Member
Registered: 20th Feb 07
Location: Essex
User status: Offline
|
Echo gives me exactly what I'm expecting to see, its as if the SendEmail function cannot see the Users Table even though the Data Macro itself is in the users table.
Regarding uniqueness, its going to be maintained, the user table contains a list of SMT and HODS, so there will only ever be one person in department "Maintenance" with a user level of "2".
This access 2010 is not nice !
I think I have just twigged something, the data macro is stored in the users table, I wonder if when it runs the send email function its looking for a field called [users] rather than [email]
Currently stuck trying to work out why a query he's put attached to a field isn't running. Reminds me of a heated discussion me and Paul J had about people not commenting or documenting what they are doing
|
Neo
Member
Registered: 20th Feb 07
Location: Essex
User status: Offline
|
quote: Originally posted by Neo
if when it runs the send email function its looking for a field called [users] rather than [email]
This Working now
|
pow
Premium Member
Registered: 11th Sep 06
Location: Hazlemere, Buckinghamshire
User status: Offline
|
Silly boy :hugs:
|
Neo
Member
Registered: 20th Feb 07
Location: Essex
User status: Offline
|
|