Results 1 to 3 of 3
  1. #1
    zinrey is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8

    Passing a name of a field in a parameter - is it possible?

    Hi all,




    I am writing a web database (so need to use macros rather than VBA). I am trying to pass a field name as a parameter (prmRole) and then use SetField to update the value of the field in a data macro in Access 2010. Unfortunately, Access kicks up the error:


    "The Identifier '[prmRole]' could not be found"


    I have tried =[prmRole], ="[prmRole]" and "[prmRole]" but not seem to help. Is this possible?


    Hopefully the attachment will upload and give more info.


    Ian
    Click image for larger version. 

Name:	macro.jpg 
Views:	11 
Size:	38.4 KB 
ID:	7483

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    I think not.

    Why do you need to? Is the data not going to the same field for each new record?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    zinrey is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8

    Solved.

    Quote Originally Posted by June7 View Post
    I think not.

    Why do you need to? Is the data not going to the same field for each new record?
    Good question as to why. I have a number of fields with names of different people on a project. By having a number of roles each defined as a new field I can pull out the roles in queries, forms, reports etc. easily.


    I have solved this with an If statement in the end. It is two step and I need one for each role so it took quite a lot more lines of code but it is working.

    i.e.

    If [prmRole]="Producer" Then
    SetField (Producer, [prmString])



    Click image for larger version. 

Name:	Untitled-1.jpg 
Views:	4 
Size:	17.0 KB 
ID:	7484

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

Similar Threads

  1. Parameter Passing
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 11-21-2011, 10:23 AM
  2. Passing List of Parameter
    By vignes10 in forum Access
    Replies: 3
    Last Post: 09-15-2011, 07:35 AM
  3. Passing a Picture frame as a parameter
    By SacredFootballLB in forum Forms
    Replies: 1
    Last Post: 09-30-2010, 11:40 AM
  4. Macro passing a parameter
    By SlowPoke in forum Access
    Replies: 1
    Last Post: 09-26-2010, 09:57 PM
  5. bypassing passing parameter when null
    By cowboy in forum Queries
    Replies: 11
    Last Post: 04-14-2010, 09:59 PM

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