Results 1 to 3 of 3

Code Programing General Question

  1. #1
    d9pierce1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Tennessee
    Posts
    140

    Code Programing General Question


    Hi all,
    I just have a question that has bothered me for quite some time. I see this frequently and I don't understand it? Maybe someone can please explain this to me.
    Below is some code I have, I didn't write, it actually came with a zipcode db I bought for reference.

    I highlighted the area of the basic question as I see different letters before a word in code and have always wanted to know why this is there? Is there a purpose?

    What is the f for in the fFound? I don't understand the random letter in front of words in code? Please explain to me...


    Code:
    Public Function GetCityState(strZip As String, strCity AsString, strState As String) As Boolean
      ' Comments:Lookup City and State based on zip code
      ' Params  : strZip          Zip code to lookup
      ' Sets    : strCity         City
      '           strState        State
      ' Returns : TRUEif zip code found, FALSE if not
      ' Created :11/15/00-LC
      ' Modified:09/15/09-LC
    
      Dim fFound As Boolean
      Dim strZipSearchAs String
    
      fFound = False
      strZipSearch =Left$(strZip, 5)
      IfLen(strZipSearch) = 5 Then
        WithmrstZipCodes
          .Index ="ZipPrimary"
          .Seek"=", strZipSearch, True
          If Not.NoMatch Then
            fFound = True
            strCity =![City]
            strState =![State]
          Else
            strCity =""
            strState =""
          End If
        End With
      End If
    
      GetCityState = fFound
    
    End Function

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,003
    It's just part of a naming convention, just like the str preceding the string variables.

    http://access.mvps.org/access/general/gen0012.htm

    You can see the f is for Flag. Personally I stick with 3 letter prefixes, so I use boo for Boolean variables.
    Paul (wino moderator)
    MS Access MVP
    www.BaldyWeb.com

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    5,763
    @d9pierce1 - if you're writing your own, here's another one that is a bit more informative in terms of things to NOT do
    https://access-programmers.co.uk/for...d.php?t=225837

    and try to stay away from reserved words
    http://allenbrowne.com/AppIssueBadWord.html
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    Sometimes I talk to myself - like when I need expert advice.

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

Similar Threads

  1. General Question
    By Gregm66 in forum Access
    Replies: 2
    Last Post: 10-05-2016, 11:10 AM
  2. General totals question
    By brownk in forum Database Design
    Replies: 8
    Last Post: 05-18-2012, 09:16 AM
  3. General Question
    By notadbadmin in forum Access
    Replies: 3
    Last Post: 08-03-2011, 08:03 PM
  4. General question
    By dollygg in forum Access
    Replies: 7
    Last Post: 12-11-2009, 05:13 PM
  5. General Database question
    By xyzz in forum Access
    Replies: 3
    Last Post: 05-20-2009, 10:28 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
  •  
Tech Forums: Microsoft Office Forums