Clearing Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Beany
    New Member
    • Nov 2006
    • 173

    Clearing Form

    Hi,

    i have an address part in my form, i select a site name from a combobox and it automatically populates my address fields.....

    i have a clear button that has a problem clearing these fields once clicked... y??

    it cant recognise the setValue= " "

    ive tried Null........... ....

    what can i put in so it clears?
  • jpatchak
    New Member
    • Oct 2006
    • 76

    #2
    Originally posted by Beany
    Hi,

    i have an address part in my form, i select a site name from a combobox and it automatically populates my address fields.....

    i have a clear button that has a problem clearing these fields once clicked... y??

    it cant recognise the setValue= " "

    ive tried Null........... ....

    what can i put in so it clears?
    Try this. Notice there is no space between the quotes.
    Code:
    me.controlname.value = ""

    Comment

    • Beany
      New Member
      • Nov 2006
      • 173

      #3
      Originally posted by jpatchak
      Try this. Notice there is no space between the quotes.
      Code:
      me.controlname.value = ""

      ive tried this, without the spaces, but it still dont recognise it????

      im confused

      Comment

      • jpatchak
        New Member
        • Oct 2006
        • 76

        #4
        Originally posted by Beany
        ive tried this, without the spaces, but it still dont recognise it????

        im confused
        Are you able to clear your combobox? If no, is your combobox bound? If so, what is it bound to? Make sure the field it is bound to allows nulls/blanks. What is your rowsource? Is "Limit to List" set to true?

        If your address control a calculated control? If so, you won't be able to set the value. If this is the case, the key will be to getting that combobox empty and then making sure your control source on the address control accounts for this. What is the control source of your address control?

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32668

          #5
          And Beany...
          Please answer all the questions in JPatchak's post before expecting answers.
          It wastes so much time and effort otherwise.

          Comment

          • Beany
            New Member
            • Nov 2006
            • 173

            #6
            Originally posted by jpatchak
            Are you able to clear your combobox? If no, is your combobox bound? If so, what is it bound to? Make sure the field it is bound to allows nulls/blanks. What is your rowsource? Is "Limit to List" set to true?

            If your address control a calculated control? If so, you won't be able to set the value. If this is the case, the key will be to getting that combobox empty and then making sure your control source on the address control accounts for this. What is the control source of your address control?

            Sorry for the late reply, Neo i was going to reply to the questions jpatchak asked me, if you give me a chance bud...

            it doesnt clear my combobox, my combobox is unbound.... how do you make ur fields bound to nulls/blanks?

            the rowsource of my combobox is SELECT [tab_newadd].[site], [tab_newadd].[address_1], [tab_newadd].[address_2], [tab_newadd].[address_3], [tab_newadd].[postcode] FROM tab_newadd ORDER BY [site];

            the limit to list is set to true.........

            the control source of one of my address fields is: =[site].Column(1)

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32668

              #7
              I wasn't criticising you for not having answered all the questions Beany.
              I was giving you advanced 'advice' that you would need to answer all the questions asked (common courtesy really) before you could reasonable expect any further help.
              Some posters seem to feel that the experts should be making all the effort while the original posters put in lazy, unclear questions and expect the experts to struggle through regardless.
              I take the view that if a poster cannot even be bothered to ask the question carefully enough that it can be understood, then they should not expect others to make any effort on their behalf. Expceptions must be made here for foreign (non-English speaking) members for whom extra allowances are made clearly.
              In similar vein, if an expert has to keep asking questions repeatedly because the questioner cannot be bothered to answer posts to his questions carefully enough then, to my mind, he can be left to fend for himself. I really cannot understand why the experts of this forum should be expected to do the donkey work for the questioner as well as providing their experience and expertise free of charge.

              Clearly this is not directed at you as you have answered the question perfectly :). This will help JPatchak (or any other expert) to help you better. It also gave me a perfect opportunity to explain the situation to anyone who reads this thread ;).

              Comment

              • Beany
                New Member
                • Nov 2006
                • 173

                #8
                I entirely agree with you........

                the experts in this forum are very helpful and friendly people. Us 'posters' should show a bit more appreciation and respect towards the experts and provide sufficient info for them to help us.


                :) anyway whats happening with my problem?

                im using the following code, can there be sumat wrong with it:

                Code:
                Private Sub clear_Click()
                Dim intResponse As Integer
                
                intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
                
                If intResponse = 6 Then
                
                   Me.Combo26.Value = " "
                   Me.address_1.Value = " "
                   Me.address_2.Value = " "
                   Me.address_3.Value = " "
                   
                    Else
                End If

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32668

                  #9
                  Hi Beany.
                  I enjoyed your response lol :).

                  I can see three potential problems with your code :
                  Code:
                  Private Sub clear_Click()
                  Dim intResponse As Integer
                  
                  intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
                  
                  If intResponse = 6 Then
                  
                     Me.Combo26.Value = " "
                     Me.address_1.Value = " "
                     Me.address_2.Value = " "
                     Me.address_3.Value = " "
                     
                      Else
                  End If
                  1. There is no code between the last two lines.
                  2. You have tried to set Me.Combo26.Valu e to a single space string, but you have Limit to List set to True. If a single space is not a valid entry for this control that will fail.
                  3. You have set the address controls to a single space string too. This may cause confusion if the operator thinks it's an empty string or Null.

                  Having highlighted these small things I will leave this and give Josh a chance to come back in. he was after all running with this one and doing a fine job. I will help further if necessary but it's only fair to let him continue.

                  Comment

                  • Beany
                    New Member
                    • Nov 2006
                    • 173

                    #10
                    Hi,

                    ive worked it out......

                    Code:
                    Private Sub clear_Click()
                    Dim intResponse As Integer
                    
                    intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
                    
                    If intResponse = 6 Then
                    
                     
                       Me.site = " "
                    
                       'Me.address_1.Value = " "
                       'Me.address_2.Value = " "
                       'Me.address_3.Value = " "
                       'Me.postcode.Value = " "
                    
                    
                        Else
                    End If
                    
                    End Sub
                    if i just clear the combobox, it clears the address fields automatically.. .

                    Comment

                    Working...