Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2012
    Posts
    3

    Unanswered: adding emails associated with contacts

    Have been working with microsoft access for 2 days now... i am so pimp at it that i am retarded...

    basically we are trying to setup a job request for other parts of our building...

    so that one section can request over time and different equipment and personal for these forms...

    so on one table we have all the contacts info and things that should prepulate on the form will assigning it to this contact

    once the form is filled out we have an email button in place that will pre populate the subject of the email in outlook but we cant get it to prepopulate the email recipient ...

    i am very sure that the coding we used is wrong... but i cant figure out whats wrong with it... cause again... IM A NOOB


    there error we get is syntax error (missing operator) in query expression '[id]= employees name that was seleceted'

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if its a string / text value then it must be encapsualted with a ' eg "id = 'licneseless"'
    if its a date value it should be encapsulted with # eg #2012/02/08#
    also Access is retarded in as much as it uses US format mm/dd/yyyy or at a pinch iso format yyyy/mm/dd. in some cricumstance it can recognise the interantionalisation settings on your computer but.....

    you don't need to enclose column or table names with [] IF the column/table names are not separated with a space
    eg
    my_column_name
    MyColumnName
    or
    [my tablename].[my column name]

    in future please post the relevant fragment of code using [ c o d e ] and [ / c o d e ] (less the spaces) which makes reading code easier on this forum. picking the correct fragment of code can be tricky.. usually 2..3 lines either side of where the error was reported. just pasting the whole code section because you can't be bothered usually elicits the response.. well if they can't be bothered why should anyone else
    Code:
    SELECT my, column, list FROM [my table]
    JOIN [my other table] on [my other table].[this column] = [my table].thatcolumn
    Last edited by healdem; 02-09-12 at 10:45.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2012
    Posts
    3
    thank you for the quick reply... i was actually trying to run across the building and get a cd so i could run back and copy the text from one computer... then run it back to the other computer so i could show you or anyone what i made... that doesnt work hahaha



    SELECT [Contacts Extended].[Contact Name], [Contacts Extended].ID FROM [Contacts Extended] ORDER BY [Contacts Extended].[Contact Name], [Contacts Extended].ID;

    so how far off am i from were i should be

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so where is the [id]= <employees name that was seleceted> bit?

    as said before if its a name it wouldhave to be encapsualted with '
    eg
    Code:
    [id]= 'licenseless'
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Feb 2012
    Posts
    3
    Quote Originally Posted by healdem View Post
    so where is the [id]= <employees name that was seleceted> bit?

    as said before if its a name it wouldhave to be encapsualted with '
    eg
    Code:
    [id]= 'licenseless'

    this is where i am stuck... does it need to be


    SELECT [Contacts Extended].[Contact Name], [Contacts Extended].ID FROM [Contacts Extended] ORDER BY [Contacts Extended].[Contact Name], [Contacts Extended].ID = [last name]

    since our column that we want the drop down to be is called last name... so that people can find everyone via there name last name first

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what is [last name]
    where is it coming from
    what are you planningon using this query in

    usually a where clause matches against another vlaue. that other value could be another column in the db or matching against a user specified value

    so if you want to allow a user to specify an employee name then you'd supply that value from, say the combo /list box if you limit to known values, or the text box the user completed. however its not smart to allow users to add values free form if their is a pre existing table. its never smart to use alphanumeric values which are prone to typos' or other confusion. ferinstance its tricky in most countries to be abel to uniquely identify a person by their name. and uniquely is a critical element in realtional db's.

    as to does it need to be.....

    I haven't got a clue, becuase Im psychotic not psychic.
    if [last name] is the name of a control on a form
    ...AND its numeric then your code would be fine
    ...AND it is alphanumeric then youd have to use either ' or " to identify the start and stop of the value.. to encapsualte it.
    if [last name] has some other meaning then bully for you.

    incidentally I'd strongly recommend that you stop using spaces in column / table names.. it will bite you in the backside at some stage. wheter you use CamelCase or underscores to separate words is your choice. some prefer to use all lower case eg my_column_name, some prefer MyColumnName, some cause grief for themsleves by using spaces.

    whilst you are at it make certain you don't use any reserved words for your table, column or variable names. do a goolg e oin ms access reserved words for a full list of words not to use
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •