By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,500 Members | 2,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,500 IT Pros & Developers. It's quick & easy.

Clearing Form

100+
P: 173
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?
Dec 28 '06 #1
Share this Question
Share on Google+
9 Replies


P: 76
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.
Expand|Select|Wrap|Line Numbers
  1. me.controlname.value = ""
Dec 28 '06 #2

100+
P: 173
Try this. Notice there is no space between the quotes.
Expand|Select|Wrap|Line Numbers
  1. me.controlname.value = ""

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

im confused
Dec 28 '06 #3

P: 76
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?
Dec 28 '06 #4

NeoPa
Expert Mod 15k+
P: 31,186
And Beany...
Please answer all the questions in JPatchak's post before expecting answers.
It wastes so much time and effort otherwise.
Dec 30 '06 #5

100+
P: 173
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)
Jan 3 '07 #6

NeoPa
Expert Mod 15k+
P: 31,186
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 ;).
Jan 3 '07 #7

100+
P: 173
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub clear_Click()
  2. Dim intResponse As Integer
  3.  
  4. intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
  5.  
  6. If intResponse = 6 Then
  7.  
  8.    Me.Combo26.Value = " "
  9.    Me.address_1.Value = " "
  10.    Me.address_2.Value = " "
  11.    Me.address_3.Value = " "
  12.  
  13.     Else
  14. End If
Jan 4 '07 #8

NeoPa
Expert Mod 15k+
P: 31,186
Hi Beany.
I enjoyed your response lol :).

I can see three potential problems with your code :
Expand|Select|Wrap|Line Numbers
  1. Private Sub clear_Click()
  2. Dim intResponse As Integer
  3.  
  4. intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
  5.  
  6. If intResponse = 6 Then
  7.  
  8.    Me.Combo26.Value = " "
  9.    Me.address_1.Value = " "
  10.    Me.address_2.Value = " "
  11.    Me.address_3.Value = " "
  12.  
  13.     Else
  14. End If
1. There is no code between the last two lines.
2. You have tried to set Me.Combo26.Value 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.
Jan 4 '07 #9

100+
P: 173
Hi,

ive worked it out......

Expand|Select|Wrap|Line Numbers
  1. Private Sub clear_Click()
  2. Dim intResponse As Integer
  3.  
  4. intResponse = MsgBox("Are you sure you want to clear all entries?", vbYesNo, "Remove")
  5.  
  6. If intResponse = 6 Then
  7.  
  8.  
  9.    Me.site = " "
  10.  
  11.    'Me.address_1.Value = " "
  12.    'Me.address_2.Value = " "
  13.    'Me.address_3.Value = " "
  14.    'Me.postcode.Value = " "
  15.  
  16.  
  17.     Else
  18. End If
  19.  
  20. End Sub
if i just clear the combobox, it clears the address fields automatically...
Jan 5 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.