Parameter set but "no current record"

kdvorkin

Registered User.
Local time
Yesterday, 18:08
Joined
Apr 2, 2012
Messages
16
Hello,

I'm using the following code to pass a parameter to a query. The parameter limits a query to a single entry, which then is set to the recordset. I then use this recordset to sends a single email to specific respondents using email addresses in the query result.

When this code runs I get an error that says "no current record", and I can't figure out why. When I run the VBA in break mode, and check the parameter value, I see that the parameter is set to the right value and should be pulling the right record into the recordset, but alas it does not, and I've been stuck on it for several days. I get a runtime error saying that there is "no current record" Please help.

This error is particularly confounding because I have a similar segment of code in another form that performs a nearly identical procedure just fine.

Thanks in advance,

Keith

I had to attach the code as the forum thinks there are email addresses in there, and I only have 9 posts so far :(
 

Attachments

PARAMETERS [Referral ID?] Short;
SELECT [Dean Emails].[Dean Email], [Demographics - Current Students].[Counselor Email], [Staff Emails].[Email - Staff], [Student Guardian Emails].[Email - Guardian], [Staff Emails].[First Name - Staff], [Staff Emails].[Last Name - Staff], Referrals.[Referral ID], Referrals.[Ref to], Referrals.[Referral Date], Referrals.[Student ID], Referrals.[Staff Logon], Referrals.Class, Referrals.Period, Referrals.Description, Referrals.[Parent contact on - teacher], Referrals.[Student conference on], Referrals.[Parent contact on - action taken], Referrals.[Detentions(s) assigned for], Referrals.[Assigned saturday detention], Referrals.[Assigned reassigned], Referrals.[Assigned suspension], Referrals.[Suspension letter given], Referrals.[Class drop], Referrals.[If repeat], Referrals.Comments, Referrals.[Signatures date], Referrals.[Student signature], Referrals.[Couns Dean Signature]
FROM (((Referrals INNER JOIN [Demographics - Current Students] ON Referrals.[Student ID] = [Demographics - Current Students].[Student Id]) INNER JOIN [Student Guardian Emails] ON [Demographics - Current Students].[Student Id] = [Student Guardian Emails].[Student Id]) INNER JOIN [Staff Emails] ON Referrals.[Staff Logon] = [Staff Emails].[Login ID - Staff]) INNER JOIN [Dean Emails] ON [Demographics - Current Students].[House Team Code] = [Dean Emails].[House Team Code]
WHERE (((Referrals.[Referral ID])=[Referral ID?]));
 
Not sure what "short" is.

Try kick out the entire

PARAMETERS [Referral ID?] Short;

line
 
Forgive me, but I'm not sure how exactly to do that. I wrote the query in the Design view just by dragging and droppping fields and joins, then just went to the SQL view to see the code. The query runs fine, prompts me for the [Referral ID?] parameter and correctly pulls the right results.

How do I see the full PARAMETERS line?
 
Sorry...do you mean just delete that line from the Query?
 
Smae result with that line deleted...Runtime Error...no current record
 
Got it! The sendobject command was running a report that pulls the Referral ID parameter, but i wasn't passing that parameter to the report (just passing it to the query). Since all i wanted to do was email the current form, I just changed the object type to acSendForm rather than acSendReport

2 days later, problem solved. Thanks for looking! Looking at the SQL of the query was the kick in th pants I needed.
 

Users who are viewing this thread

Back
Top Bottom