Results 1 to 4 of 4
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528

    convert expression to public


    Hello guys
    Is it possible to convert this expression to a public function Or code vba .
    Thanks in advance

    Field: IIf([Expr1]>=[Params1];[Computer];IIf([Expr1]>=[Params2];[Maths];IIf([Expr1]>=[Params3];[Statistics];IIf([Expr1]>=[Params4];[Medical];" "))))

    Expr1
    SELECT [TotalScores]/7 AS Expr1, IIf([Expr1]>=[Params1],[Computer],IIf([Expr1]>=[Params2],[Maths],IIf([Expr1]>=[Params3],[Statistics],IIf([Expr1]>=[Params4],[Medical]," ")))) AS Field, Right([yars],2) & "" & [NoAccepCentral] & "" & [field] AS Expr2, [Field] AS uu, tbStudents.StuID, tbStudents.NoAccepCentral, tbStudents.yars, tbStudents.StudentName, tbStudents.FigAla, tbStudents.City, tbStudents.HighSchool, tbStudents.Branch, tbStudents.TotalScores, tbStudents.University, tbStudents.Computer, tbStudents.Maths, tbStudents.Statistics, tbStudents.Medical
    FROM tbStudents, Table2;

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A public function is VBA code.

    The function would have to open a recordset or the values in all nine fields would have to be passed as arguments of the function.

    Why would you want a function when this is a fairly simple expression and all the necessary values are available in the query?
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you John
    I have text boxes on the form I want quick access to the values ​​of this expression

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't really understand how a function will assist with that.
    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.

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

Similar Threads

  1. sqlString to create Public Sub
    By Kiteknight in forum Programming
    Replies: 10
    Last Post: 01-04-2014, 10:06 PM
  2. Convert recalc VBA expression to Macro
    By mikenificent in forum Access
    Replies: 9
    Last Post: 10-22-2012, 07:14 AM
  3. public variables
    By zul in forum Programming
    Replies: 3
    Last Post: 08-23-2011, 11:11 AM
  4. Replies: 9
    Last Post: 12-20-2010, 08:05 PM
  5. public instead of dim not working
    By DKY in forum Access
    Replies: 1
    Last Post: 10-14-2008, 11:42 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