Results 1 to 13 of 13
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    That is the syntax that I used


    That is the syntax that I have been using. The two files attached one a db the other a screenshot of the code show that.

    I am just not sure what to do. The varTO is set equal to "null".

    The other equation that I have is why can't I use emailaddress? I must use email address or the frmEmail will not open up via frmPersonnel, except in a blank screen.
    Thus I am forced to use email address and I think that we agree that creates a lot of problems.

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Thumbnails Attached Thumbnails 2017-04-07_15-15-31.png  
    Attached Files Attached Files

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Your field in tblPersonnel is still "email address" - that is why you have to reference it as [email address].

    You should also be checking if cbofullname is null/zls and burp a message that it must be selected before an email can be sent.

    And your cbofullname combobox rowsource is hosed again:

    SELECT [Query to set name and email address together].[email address], [Query to set name and email address together].[FullName] FROM [Query to set name and email address together];

    Please correct as mentioned in prior posts.

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Code:
    Your field in tblPersonnel is still "email address" - that is why you have to reference it as [email address].
    That is the point that I was trying to make in another thread. If I write email address as emailaddress leaving the space out and change it in all of the instances it is used,
    then problems occur. The form frmEmail opens up alright when clicked from the navigation window, but it can also be opened up via form frmPersonnel and that is the issue.
    When I open up frmEmail from form frmPersonnel with the modification made, I get a blank white form. There is no detail in the form at all - it is all white.

    If I remove that modification and rewrite emailaddress as email address then this error goes away. I am not sure why this is happening, I have a zipped file to show it, but I cannot seem to upload this morning. I have no reason why that is happening. Still the file that I attached in my email Division_Dashboard_16.zip can be easily modified to demo my point.

    If that is changed as described above the error will show itself. What is going on?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  4. #4
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    I finally got the db uploaded

    Okay, here is the modified Divisaon_Dashoard db that opens up a blank form when I
    click it to open form frmEmail from form frmPersonnel.


    I am not sure why this is happening. Please explain.

    Respectfully,


    Lou Reed
    Attached Files Attached Files

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I tried using email_address instead of email address or emailaddress and I still got a blank screen when I opened up frmEmail from frmPersonnel.

    I just do not know what is happening here.

    Respectfully,

    Lou Reed

  6. #6
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Click image for larger version. 

Name:	Division_Dashboard_frmPersonnel_Macro.png 
Views:	15 
Size:	6.5 KB 
ID:	28213
    In your embedded Macro above for the email command button, for the Where Condition, you added "=" before the condition. In this case, the "=" symbol is not to be used. Remove it from your condition and then it will open the email form with data. I would add a check to make sure the email address is populated before opening the email form. Also, I'm not a fan of macros - I like doing everything in VBA code which is much more flexible and feature rich.

  7. #7
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I did not do it in Macros. I did it is VBA code. I am not sure what happened here.

    I also am not a fan of Macros since they seem to be awkward. However, if one cannot get the VBA code the Macros are there.

    I will try what you said.

    How to avoid this in the future? This seems a bit subtle!

    Respectfully,

    Lou Reed

  8. #8
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    The OnClick Property for that button is set to run the embedded macro that I showed you. How it got there I haven't an idea as I do not use embedded macros. I presume if you change it to Event Procedure it will wipe it out. Change it to Event Proceedure, and then have code to check if an email address is present - if present, then open frmEmail passing [emailaddress] (the control name on frmPersonnel) as the criteria.

  9. #9
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    This still gives varTO variable as null

    Maybe I should ask a more direct question. How did you find that error? Forget about how to avoid this error in the future, just how did you go about finding this error in the first place?

    I have attached to this email the db with that error corrected. It still does not work correctly. The varTO variable still comes out null. I just cannot understand why.

    Any help appreciated. Thanks in advance.


    Respectfully,


    Lou Reed
    Attached Files Attached Files

  10. #10
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    I found the errant code by troubleshooting the problem. You stated on click of the command button frmEmail opened empty, so looked at the onclick event and it had the embedded macro, clicked the 3-dot ellipsis for that property and bam, there was the problem.

    Change: stWhere = "[qryPersonnelMeeting].[emailaddress] = " & "'" & StWho & "'"
    to: stWhere = "[qryPersonnelMeeting].[FullName] = " & "'" & StWho & "'"

    I'd work on naming conventions for your objects. "Query to set name and email address together" would be best named something like qryPersonnelNameEmailAddress, perhaps.

    I gotta ask... You already have the email address for the selected employee in Control emailaddress - why even bother doing the DLookup?

  11. #11
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    [code]
    I gotta ask... You already have the email address for the selected employee in Control emailaddress - why even bother doing the DLookup?
    [code]

    That is a good question. I really have no answer for it now. I thought along similar lines myself but abandoned the idea. The experts who wrote the email ticket, tech support

    code seems to know what they were do and thus I just followed their lead. To be honest, I have never had a DLookuo function work, that I wrote. I guess that I should gone with my instinct

    and just add the email address directly.

    Anyway thanks for pointing that out.

    Respectfully,

    Lou Reed

  12. #12
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Okie Doke. Best of luck moving forward.

  13. #13
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    It may seem odd, but for someone who has been programming off and on since the seventies, I find programming in MS Access VBA to be hard. It is almost like going back to square one. I glad I did it. But I really did not have any idea what I was in for when I started. I had used Excel VBA, so I volunteered for this project when it came up. If I knew then what I know now. Well you get the idea.

    Anyway, thanks for you help. Do most people find programming in MS Access VBA somewhat difficult?

    Thanks again.

    Respectfully,

    Lou Reed

Please reply to this thread with any new information or opinions.

Similar Threads

  1. need help with syntax of SQL
    By vicsaccess in forum Programming
    Replies: 7
    Last Post: 04-12-2016, 03:23 PM
  2. Help with GUI Syntax and/or SQL
    By hellfire45 in forum Access
    Replies: 4
    Last Post: 04-01-2015, 12:55 PM
  3. Help with syntax
    By GWB in forum Queries
    Replies: 4
    Last Post: 01-26-2011, 03:33 PM
  4. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  5. Please help SQL Syntax
    By jordanturner in forum Access
    Replies: 4
    Last Post: 09-02-2010, 08:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums