Results 1 to 5 of 5

Thread: SetValue Macro

  1. #1
    Join Date
    Mar 2015
    Posts
    17

    Unanswered: SetValue Macro

    What is wrong with this macro please:
    SetValue
    Item=[Forms]![frmEmployee]![TrainingID]
    Expression='SELECT tblTraining.ID, tblTraining.Description FROM tblTraining WHERE (((tblTraining.JobTitle.Value)=[Forms]![frmEmployee]![JobTitle])) ORDER BY tblTraining.Description'

    When I run this, i receive message that says... 'Cannot perform this operation' and when i press help on this box it shows me Error 3032. What am i doing wrong please??

    Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Could be anything. I dont use macros, so I dont know, but:-
    You are specifying two columns from the db in the SELECT but the destination looks like a single control
    if JobTitle is a string/text column then the value from the form should be delimited with a pair of ' or " characters
    afaik there is no .value property on a column so jobtitle.value =... should read jobtitle =...
    ...there is a .value property on form / report controls.
    does the query run if you paste it into a query directly

  3. #3
    Join Date
    Mar 2015
    Posts
    17
    Quote Originally Posted by healdem View Post
    :-
    You are specifying two columns from the db in the SELECT but the destination looks like a single control
    if JobTitle is a string/text column then the value from the form should be delimited with a pair of ' or " characters
    afaik there is no .value property on a column so jobtitle.value =... should read jobtitle =...
    ...there is a .value property on form / report controls.
    does the query run if you paste it into a query directly
    Thanks Healdem, yes destination is a single control of multi-value combo-box for column JobTitle because one Training should be completed by people with various JobTitles and vice versa.
    One more thing please, am i using the correct format in 'Expression' field... i mean can i use the 'SELECT...' statement inside single quote to get a value for the column?? Is there a better way to do that please??

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you are setting a value in a combo or list box then it can only be a single column
    I don't know if you can use a query as an expression in a macro, because i've never tried it and in any event fidn macros too limiting

    are you trying to change all the data in the combo or just the current value?
    if you are trying to change all the data then you need to change the rowsource property of the combo box
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2015
    Posts
    17
    thanks healdem, it helpled

Posting Permissions

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