Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Usps_city_from_zip() ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Usps_city_from_zip() ?

    This thread has enhanced my knowledge also.

    I wish I could give you a better answer. The only definitive answer I can give you is, "I'm not sure." So, all I can do is explain where I'm coming from...

    I have never used "form." because I didn't even know it was valid. I remember when .refresh() was first available and that it didn't always work the way I thought it would. Apparently it didn't work the way others expected either and eventually Alpha came out with the .Refresh_layout() command which seems to work in more situations. However, I don't have any idea why.

    All I can say is that I've had better luck with .Refresh_layout(). If form.refresh_fields() works then I see no problem with using it. (I'm kinda curious whether or not parentform.refresh() would work.)

    I have used .refresh() to refresh specific objects on a form and that generally seems to work well. (e.g., parentform:invc_ttlf.refresh())

    Comment


      #17
      Re: Usps_city_from_zip() ?

      Cal

      I tried Parentform.refresh() and got the same error message.

      Parentform.refresh_fields() works as does Parentform.refresh_layout().

      I just can't get form.refresh() to work. But then I don't really need to with the other options.

      Again Cal thanks for the down to earth explanation.

      Tom Baker

      Comment


        #18
        Re: Usps_city_from_zip() ?

        Originally posted by Tbaker View Post
        Cal

        I'm not trying to beat a dead horse since Ray has gotten his app working with your help.

        But when I used form.refresh() in the onwrotefield for zipcode and then opened the form, I get an error message (see attached thumbnail).

        I also attached a thumbnail of the onwrotefield event.

        That is why I didn't think that would work and suggested form.refresh_fields() which does work.

        I guess this is just to enhance my knowledge.

        Thanks

        Tom Baker
        Hi Tom,

        I am not sure y you are getting the error you are, I tried putting the form.refresh() in your sample table and I am NOT getting the error you are, it works fine however when I first opened you database I did get a startup form error because the form that was set was not in the database. This is just a hunch try resetting the startup form to form_zip and see what happens.

        What version of Windows are you running? I am running Windows Vista, I have sen in some cases the different version of windows will make programs act different.

        FYI Tom,
        I just went into your form and see you have a OnDeport event of- parentform.Repaint()

        My form does NOT have that.
        Last edited by Rayr; 06-02-2008, 04:48 PM.
        Kind Regards,
        Ray Roosa
        Raylin Micro, LLC.

        Comment


          #19
          Re: Usps_city_from_zip() ?

          Just a thought, but couldn't this also be done without using a field rule? Instead, on the 'OnDepart' event for the zip code field, create a simple action script that sets the values for the city and state fields using the USPS functions? I tried it and it seemed to work fine. I would be curious to any other reasons for/against this... thanks.

          Comment


            #20
            Re: Usps_city_from_zip() ?

            Originally posted by smrogers View Post
            Just a thought, but couldn't this also be done without using a field rule? Instead, on the 'OnDepart' event for the zip code field, create a simple action script that sets the values for the city and state fields using the USPS functions? I tried it and it seemed to work fine. I would be curious to any other reasons for/against this... thanks.
            Hi Shawn,

            Sure you could use the 'OnDepart' event but that is at the form level, what I wanted is at the table level so I would NOT have to stick the code on every single layout I make, forms, browse, ect. Form level actions are good if it is only based on that form but if you want something to happen every time no matter what form, report, browse, ect. is used I find it better to use the events in the field rules. I am no export in Alpha Five but I was considered an export with the DOS versions of Alpha but I am only now getting back into programing and the Window environment is a whole new game so if someone disagree with my way of thinking please let us all know.
            Kind Regards,
            Ray Roosa
            Raylin Micro, LLC.

            Comment


              #21
              Re: Usps_city_from_zip() ?

              Ray

              I'm running Windows XP Service Pack 2.

              I can get form. to work with refresh_fields() and refresh_layout() as well as
              parentform.refresh_fields(), parentform.refresh_layout().

              I guess I asked and continued just to increase my own knowledge of these quirky code snipets.

              Oh by the way, the reason you got the error when you loaded the zip file was because I use that file for a lot my own testing - I add and subtract fields as I need them to tese different functions and to test replies that I'm going to post to make sure they work. I had an original form test_time that was a startup form and I dropped it from the table to zip the test_zip app. It had nothing to do with the test app that I sent.

              Ray thanks for coming back to me - with this forum you learn something new everytime you log on. Your post is an excellent training ground for beginner alpha's.

              I glad you got your app to work the way you needed it - that in itself is satisfying.

              Tom Baker

              Comment


                #22
                Re: Usps_city_from_zip() ?

                Tom,
                regarding the .refresh() function. From what I can gather it is to be used for an object as the example suggests in the help file (although the first part of the documentation states otherwise! ).
                http://support.alphasoftware.com/alp....REFRESH().htm

                :invoices:sales_tax.refresh()
                Another part of the documentation states it a bit different:
                http://support.alphasoftware.com/alp...nd_Methods.htm
                Forces a control to re-fetch data from its data source, and then to repaint itself. Works with all controls.
                I think the second explanation seems to be the more likely one as it does agree with what your findings were.

                Least that is my take on it--somewhat contradictory as I have never heard of a form or browse called a control before.

                Boy does Alpha need someone to go through these files--actually more like a multiple person job considering how it continues to grow--one to keep up with new functions/features, one or more to try and catch up with the backlog of corrections and absences of documentation.
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #23
                  Re: Usps_city_from_zip() ?

                  Thanks Mike.

                  This has been a very interesting thread. As I said before and we all acknowledge - "You learn something new everytime you open the forum"

                  Tom Baker

                  Comment


                    #24
                    Re: Usps_city_from_zip() ?

                    I have just finished using this code in my own address book database. The problem that I am facing is that after entering the zipcode the city and state fields remain unchanged until I enter each of those fields. I would like it to change the city and state fields as soon as I exit the zipcode field. What do I need to do to get this to work?

                    Comment


                      #25
                      Re: Usps_city_from_zip() ?

                      Have you tried refreshing the other two fields using the OnDepart of the field you are leaving?
                      Mike
                      __________________________________________
                      It is only when we forget all our learning that we begin to know.
                      It's not what you look at that matters, it's what you see.
                      Henry David Thoreau
                      __________________________________________



                      Comment


                        #26
                        Re: Usps_city_from_zip() ?

                        THis is what I have put in both the ondepart and onchange events in the zip_code field:

                        IF eval_valid( "parentform.this" )
                        parentform.Repaint()
                        parentform.Refresh_fields()
                        END IF

                        I have also tried the following two with no difference in results.

                        IF eval_valid( "parentform.this" )
                        parentform.Refresh_fields()
                        END IF

                        and

                        IF eval_valid( "parentform.this" )
                        parentform.Repaint()
                        END IF

                        Comment


                          #27
                          Re: Usps_city_from_zip() ?

                          Have you tried the simple

                          Code:
                           parentform.refresh_layout()
                          Tom

                          Comment


                            #28
                            Re: Usps_city_from_zip() ?

                            Here is a sample

                            I think this is what you want

                            All the code for the lookup and entering city and state into the form is in the onDepart event for the zipcode field using usps_citystate_from_zip().

                            Tom Baker

                            Comment


                              #29
                              Re: Usps_city_from_zip() ?

                              Harold

                              I had some time so I put another zip file together. It has two tables Contacts and contacts_two - and two forms form1 based on contacts and form2 based on contacts_two.

                              Contacts and form1 were in the first zip I sent in the last post and all the code for the zip code lookup is in the OnDepart event for the zipcode field.

                              In contacts_two and form2 , all the code for the zipcode lookup is in the zipcode field rules event OnWroteField. There is no OnDepart event for the field zipcode on the form. The code has changed a little since I first put this in this post in 2008.

                              Here is the new code for the OnWroteField Event for zipcode in field rules.

                              Code:
                              dim tbl as p
                              dim cityst as p
                              tbl=table.current()
                              
                              cityst=usps_citystate_from_zip(tbl.zipcode)
                              
                              tbl.city=cityst.city
                              tbl.st=cityst.state
                              
                              topparent.refresh_layout()
                              This handles both scenarios - for those who do not want it as a form level event you have form2 and the OnWroteField field rules field event for zipcode and nothing in the events at the form level. Form1 has all the code for the lookup and form fill in the OnDepart event for zipcode and nothing in the field rules at the table level.

                              I re-read the post and we were discussing field rule events not form events - I posted the first zip based on the current discussion as to ondepart and onchange form events, but then decided to redo the table level event in field rules.

                              Both of the forms and the underlying rules whether at the form level or at the field rules table level work and refresh the form immediately upon leaving the zipcode field.

                              Hope one of these scenarios are what you want.

                              Tom Baker
                              Last edited by Tbaker; 08-08-2009, 10:34 PM. Reason: changed zip file

                              Comment

                              Working...
                              X