Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

    Convert Private Function to Public Function

    Hi friends



    I have this code in form. how can I use it in module (Public) ?

    Code:
    Private Function ExtractLetters(ByVal strIn As String) As Boolean
      Dim i As Integer, iLen As Integer, _
          strChar As String, iChar As Integer
      
      iLen = Len(strIn)
      If iLen > 0 Then
        strIn = UCase(strIn)
        For i = 1 To 29
        Me("V" & i) = vbNullString
        Next i
        For i = 1 To iLen
          strChar = Mid(strIn, i, 1)
          Select Case strChar
          Case "Ç"
            iChar = 1
          Case "È"
            iChar = 2
          Case "Ì"
            iChar = 3
          Case "Ï"
            iChar = 4
        Case Else
          End Select
         Me("V" & iChar) = Me("V" & iChar) & strChar
        Next i
      End If
      ExtractLetters = (Err = 0)
    End Function

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    when you put it into a module the Me predicate will not work, so add the form as a parameter

    Code:
    Function ExtractLetters(frm as Form, ByVal strIn As String) As Boolean
      Dim i As Integer, iLen As Integer, _
          strChar As String, iChar As Integer
      
      iLen = Len(strIn)
      If iLen > 0 Then
        strIn = UCase(strIn)
        For i = 1 To 29
        Frm("V" & i) = vbNullString
        Next I
       …
       ...

  3. #3
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

    Convert Private Function to Public Function

    Unfortunately I could not succeed
    I put a sample. please check

    extract.zip


  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    I've checked - and you haven't done anything

  5. #5
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    This was the first sample.
    Thanks, if you have time to complete it

  6. #6
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

    Convert Private Function to Public Function

    ok . I do something
    Attached Files Attached Files

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    your call is wrong.

    you just need Me, not me.descrip

    and you have not included whatever string is required

  8. #8
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    can anyone Fix it ??
    or create another module for extracting Letters ??

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    have you tried the solution I advised? If so, what was the outcome?

  10. #10
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    Unfortunately I did not get a result.
    I do not know how to write it

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    what does 'did not get a result' mean? you got an error? if so what is the error? something else?

  12. #12
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    thank you for all thing. I using Private Function ...

  13. #13
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Here you go. This works.

  14. #14
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

  15. #15
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    I'll post this in the spirit of 'teaching a man to fish' as the saying goes rather than download the fix to see if scope was explained.

    https://docs.microsoft.com/en-us/off...and-visibility

    Maybe your problem became one of using the Private keyword in a standard module as is suggested in post 12.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Private Function
    By UT227 in forum Programming
    Replies: 7
    Last Post: 05-03-2018, 09:47 AM
  2. Replies: 2
    Last Post: 02-10-2014, 07:41 AM
  3. Turning Private Function Into Public
    By g4tv4life in forum Programming
    Replies: 1
    Last Post: 02-04-2014, 05:31 PM
  4. Calling a Private Function from Another Form
    By MintChipMadness in forum Programming
    Replies: 1
    Last Post: 01-07-2013, 12:08 PM
  5. Replies: 9
    Last Post: 12-20-2010, 08:05 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