delete from combo box

Why deletion from a combo box is not working ? I have a control in my form
called productid. In the onClick event of  this control i have :
Dim StrSQL As String
StrSQL = "DELETE * FROM [order details1] WHERE ProductID = " & Me!productid &
";"
CurrentDb.Execute StrSQL

When i change the control from a text box into a combo box nothing happens
and no deletion occurs.However when i change again from como box into a text
box the deletion is OK. How can i make the onclick event work also with the
combo box ?

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
peljo
12/16/2007 7:54:55 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
582 Views

Similar Articles

[PageSpeed] 35

Hi Peljo,

One way to find out why it doesn't work:

After the strSQL line in your code but before the CurrentDb.Execute StrSQL 
line type this:
debug.print "productid: " & Me!productid
debug.print "StrSQL: " & StrSQL

Run your code
Go Ctl + G to open the immediate window

If the productid is null, we can help you to get the productid from the 
combobox.
The productid needs to be in the bound column of your combobox

If the productid has a value, then copy the SQL string from the immediate 
window into a new query in SQL view.
Switch the query to datasheet view as a way to check if there is any problem 
with the query string.

Jeanette Cunningham



"peljo via AccessMonster.com" <u19312@uwe> wrote in message 
news:7cc97bcb16f66@uwe...
> Why deletion from a combo box is not working ? I have a control in my form
> called productid. In the onClick event of  this control i have :
> Dim StrSQL As String
> StrSQL = "DELETE * FROM [order details1] WHERE ProductID = " & 
> Me!productid &
> ";"
> CurrentDb.Execute StrSQL
>
> When i change the control from a text box into a combo box nothing happens
> and no deletion occurs.However when i change again from como box into a 
> text
> box the deletion is OK. How can i make the onclick event work also with 
> the
> combo box ?
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1
> 


0
Jeanette
12/16/2007 8:30:15 PM
I'm not sure I'm following completely, but it sounds like the combobox
doesn't "know" that the item was deleted.

Perhaps, in the Click event, you could add:

    Me.MyComboBox.Requey

after the deletion ... this should refill the combobox list.

-- 
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/


"peljo via AccessMonster.com" <u19312@uwe> wrote in message
news:7cc97bcb16f66@uwe...
> Why deletion from a combo box is not working ? I have a control in my form
> called productid. In the onClick event of  this control i have :
> Dim StrSQL As String
> StrSQL = "DELETE * FROM [order details1] WHERE ProductID = " &
Me!productid &
> ";"
> CurrentDb.Execute StrSQL
>
> When i change the control from a text box into a combo box nothing happens
> and no deletion occurs.However when i change again from como box into a
text
> box the deletion is OK. How can i make the onclick event work also with
the
> combo box ?
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1
>

0
Jeff
12/17/2007 1:29:18 AM
oops, that should have been

    Me.MyComboBox.Requery

Jeff

"Jeff Boyce" <JeffBoyce_IF@msn.com-DISCARD_HYPHEN_TO_END> wrote in message
news:eulZXxEQIHA.6036@TK2MSFTNGP03.phx.gbl...
> I'm not sure I'm following completely, but it sounds like the combobox
> doesn't "know" that the item was deleted.
>
> Perhaps, in the Click event, you could add:
>
>     Me.MyComboBox.Requey
>
> after the deletion ... this should refill the combobox list.
>
> -- 
> Regards
>
> Jeff Boyce
> www.InformationFutures.net
>
> Microsoft Office/Access MVP
> http://mvp.support.microsoft.com/
>
> Microsoft IT Academy Program Mentor
> http://microsoftitacademy.com/
>
>
> "peljo via AccessMonster.com" <u19312@uwe> wrote in message
> news:7cc97bcb16f66@uwe...
> > Why deletion from a combo box is not working ? I have a control in my
form
> > called productid. In the onClick event of  this control i have :
> > Dim StrSQL As String
> > StrSQL = "DELETE * FROM [order details1] WHERE ProductID = " &
> Me!productid &
> > ";"
> > CurrentDb.Execute StrSQL
> >
> > When i change the control from a text box into a combo box nothing
happens
> > and no deletion occurs.However when i change again from como box into a
> text
> > box the deletion is OK. How can i make the onclick event work also with
> the
> > combo box ?
> >
> > -- 
> > Message posted via AccessMonster.com
> > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1
> >
>

0
Jeff
12/17/2007 1:33:11 AM
Reply:

Similar Artilces:

How to Recover Deleted Sent Mail?
While trying to delete very old "Sent" mail I seem to have deleted all "Sent" mail. Is there a way of recovering this mail? Have you closed Outlook since deleting the old sent mail? http://www.howto-outlook.com/howto/restoredeleteditemsfromanoutlookpst.htm might help. Next time, archive the items you want removed from your active .pst file. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, Sidney Friedman as...

Cannot delete subreport
I am using Access 2003 and have a report I did a while back with a simple subreport. I want to remove the subreport but for the life of me can't figure out how to do it. Any help would be greatly appreciated. Thanks. Hi - When you say "remove the sub report", what do you mean? Do you want to delete the entire subreport control containing the subreport, or do you want to keep the control, but change the report contained in it? The first is easy - select the control by clicking once on it once, then press delete. For the second, click the control once, then set ...

Forms Controls
I'm using a group box with several check boxes in a spreadsheet. I need to use forms controls instead of activex and i haven't figured out how to change the font in the group box label or check box labels. What am i missing here? Nothing. You can't do it with the controls from the Forms toolbar. Patti wrote: > > I'm using a group box with several check boxes in a spreadsheet. I need to use forms controls instead of activex and i haven't figured out how to change the font in the group box label or check box labels. What am i missing here? -- Dave Peterson ec35...

Rule for Deleted Items
I am being told that there is a rule in place on my Exchange server that will not empty the deleted items folder every 30 days for certain users in my organization. I found a recipient policy in System Manager that says "Users Excluded from Mailbox Cleanup" but it only shows 2 users and not the 3 I was told about. But I have confirmed that the missing person has email in her deleted items folder going back to 2005 so it must be working. Is there any other location I should be looking? Also, we just had someone come in and migrate our Exchange environment from 2000 to a new...

cannot delete message from deleted items
I have a message in my deleted items folder that when choosing delete opens the McAfee box warning of potential virus and wants me to choose open or do not open, but will not delete. I have tried choosing another file and holding ctrl and choosing the file I want deleted and then choosing delete, I have tried moving it to the desktop but it will only copy there, I have tried every form of delete possible. I need help. Anyone know how? Outlook 2002. Can you empty the deleted items folder entirely? Or turn off the McAfee scanning temporarily to see if it makes a difference? Julie wr...

Tabbing between text boxes and locking all else.
I have built a user form using Excel 2000, I used the "View - Toolbars - Control Tool Box - Text Box" to make areas where the user can enter data. I saved this as a template and when I try to move from one box to the next using the Tab key, nothing happens, cursur won't move to the next box. I have to use the mouse to click on the next box to make it work. I would also like to make the sheet so that when it is opened up, the only place you can type are in the text boxes. I tried protecting the sheet, but that doesn't seem to do what I am looking for. (Unless I am doing s...

Combo Box to show images
Hi There I am wondering if someone can help me. I am using access to create a survey/questionnaire that children with disabilities will be using. I am trying to make it user friendly for them and I am at the beginning and already hit a snag. I am using Access 2007 although I can use 2002 if it will make it easier (used to using that, trying to get to grips with new layout in 2007 still). There are several questions, some of them are straighforward and will just have space for them to type and answer. The ones I am trying to do at the moment says something like... What do you like doing ...

I can not delete a duplicate personal folders list #2
Vall... amazing that there isn't an easy fix for this. The instructions provided simply don't work ( tools-email accounts-view change email accounts-deliver to new account-finish-close outlook and reopen ), and none of the other offered explanations have worked either. As this is such a common problem; why hasn't microsoft provided a very EASY fix? I am more confused ( and frightened ) and don't want to make the problem worse! Your profile is corrupt, probably based on an incorrect migration of your ..pst file. Create a new mail profile and configure it to use your exi...

Retrieval of Deleted Items After Being Deleted from the Deleted Items File
I deleted a number of important emails from the deleted items file in Outlook 2000. This may sound stupid, but I completely emptied the deleted items file instead of deleting them one by one. Pretty stupid, huh. Anyone. Can they be retrieved? Please help. Thanks. Sorry for sending this again but I seem to be computer illiterate and it has taken me some time to explain the whole situation. Thanks again. unless you use Exchange server with deleted retention enabled, you are most likely out of luck, but you can try something that might help.... http://www.outlook-tips.net/howto/r...

Message Box strangeness
I have included the chunk of code with a few names changed, but the functionality is there. I think it will be easier for me to explain my problem after you take a quick glance at the code: onConnectButton() { int go=-1; if(c_task_check.GetCheck()) { go=MessageBox("Doing this will erase old data","Warning",MB_OKCANCEL); } int start=start_server(); if(start==WAITING_FOR_CLIENT) { SetDlgItemText(ServerEdit,"Connected to Client"); c_button1.EnableWindow(true); c_button2.EnableWindow(true); c_button3.EnableWindow(false); c_button4.EnableWindo...

Delete macros
I am using Excel 2002. When I click on Tools->Macro->Macros... i see 2 macros. The problem I am having is that I can't delete these macros, the delete button to the right is grayed out. How can I delete these macros? Hi maybe the macros are protected. Try hitting ALT + F11 to open the VBA editor and try to delete the macros / modules there -- Regards Frank Kabel Frankfurt, Germany excel777 wrote: > I am using Excel 2002. When I click on Tools->Macro->Macros... i see > 2 macros. The problem I am having is that I can't delete these > macros, the delete button to ...

Check boxes to text 05-12-10
Is there any way that I can have check boxes automaticaly transfer their information to text? example: Check boxes = red, blue, green If you click the red and green check boxes, the title would be as bellow. Title on the page = Lable order for: red, green Thank you Again, what you ask is at present incomprehensible. If the link I posted earlier does not work for you then the alternative is a userform - For the basics, see Word MVP FAQ - Userforms http://word.mvps.org/FAQs/Userforms.htm for a more in depth explanation, see http://gregmaxey.mvps.org/Create_and_employ_a_User...

deleting email in outlook, freezes before i can delete
i have a file with pics that symetec scanner says is to large. i can receieve email but cannot send any. it freezes before i can delete and says non responding. Hi All, I want to re-raise the old issue of Fax numbers showing up in the Outlook Address book when one is sending an email. I know that this can be stopped by prepending the Contact's fax number with a letter so that Outlook doesn't see it as a valid fax number and therefore doesn't list it. What's always puzzled me, however, is that this fix doesn't work if the fax numbers are changed using an export to CSV...

OK to delete Deleted Items folder?
I'm afraid I'll have to delete my Deleted Items folder in Outlook 2000. When I try to empty the folder I get a "The messaging interfce has returned an unknown error. If the problem persists Restart Outlook" message. Is it possible to delete the entire folder and replace it with an empty new one? Will it create any problems? TIA Henrik Not possible. Run scanpst.exe against your pst-file to scan it for errors first. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Se...

How to delete chart
I created a histogram and want to delete it. I select it and the faint double border apperars. There are no square handles like in 2003. Then I press the Delete key. The faint double border goes away replaced by a single thin black border. The chart is still there and is not able to be selected at all. I entered "delete chart" in the Excel Help window, and there was nothing at all on deleting a chart. Ditto for "remove chart." I got no help searching on the internet either. I have Excel 2007 and Windows XP Professional When the border changes, can you press Delete a...

Delete blank Last page
In a word document where the last page is blank due to editing or whatnot, how do you get rid of the frigg' thing. This is a Visio newsgroup - your question was about Word. However, I have had this problem as you have. Narrowing the margins and line spacing on the page previous to the last may get rid of this annoying "blank" page for you. - Jeff Chapman "silkies" <silkies@discussions.microsoft.com> wrote in message news:BDCC1FF1-50D0-42CE-BA84-868CB26A43AC@microsoft.com... > In a word document where the last page is blank due to editing or > whatnot...

Change font or increase size of spellcheck box
I'm working on a laptop, and the text in the spellcheck box is a little smaller than I can read comfortably. Is it possible to enlarge it? I'm using Word 2003. Thanks. No - it is written in stone. Your choices are to reduce the resolution of your display adapter to something that is more visible, or use the Windows accessibility options to magnify the text. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://w...

Deleting an email
I have an email (with a file attached) that is "hung up" in my outbox of Microsoft Outlook. Now I can't send or receive emails in Outlook. How can I delete the email that is "hung up"? Define hung up. Is it trying to send it? If so, disconnect your connection while it's trying to send and wait. It will time out after a bit and you should be able to delete it. Reconnect. "Aaron Hurliman" <AaronLHurliman@aol.com> wrote in message news:03b001c34f39$0fb61ff0$a301280a@phx.gbl... > I have an email (with a file attached) that is "hung up&q...

Recovering Unrecoverable Deleted Public Folders
Long, sad story with a punch line (which is worth getting to): Exchange 2003. Ran into a situation where a user deleted 10 public folders by mistake. Using Recover Deleted Items to retrieve them, got back five of the folders (the ones that were empty in the first place) but we received the following error message when attempting to recover the other five (the ones with actual stuff in them): "Outlook was unable to recover some or all of the items in this folder. Make sure you have the required permissions to recover items in this folder and try again. If the problem persists contact you...

office 97 box id number
Having problem with Office 97 pro...need to reinstall. Program asks for 1d on crystal box. Been 4 years since purchased, have no box. PC shows registration number. More numbers than asked for. How do I contact Microsoft to obtain number? Been thru site and only paid site accessible. Supposed to have 4 free inquiries. ...

pain in the butt dialog boxes
I have a little problem that's been driving me absolutely nuts. All I want to do is have a dialog box pop up in the middle of my windows api and c++ program get a number in a textbox and the let my windows api program pop open a window that does the real stuff. but I've tried several things and many many websites and haven't been able to figure out how to make the damn thing work. I've already written the code for the main program, I just can't get any input other than direct keyboard messages. I'm using directx in the main program so that complicates it some but I&#...

Constructor of dialog box...
I have an MFC VC++6 project. In a dialog box I want to pass a CString variable when I call the dialog class. And I want the CString variable to populate a static text box. For example: void MyParentDlg::OnButton() { MyDialog aa(NULL, "hello"); aa.DoModal(); } //Start of MyDialog class code CString hold; MyDialog::MyDialog(CWnd* pParent /*=NULL*/, CString PassString) : CDialog(MyDialog::IDD, pParent) { hold = PassString; } BOOL MyDialog::OnInitDialog() { CDialog::OnInitDialog(); m_MyStaticTextBox.SetWindowText(hold); return TRUE; } Is this the best way to se...

How do I delete a message in my outbox that contains a large file
I tried to send an email containing a large enclosure. Too large to send and now the message is stuck in my outbox. How do I delete the message? I have tried the normal route - cut, delete, but it stays in the outbox and slows down my send/receive capabilities "Lillian" <Lillian@discussions.microsoft.com> wrote in message news:C11E7BA3-C410-48CC-8B15-F6EA284665E7@microsoft.com... > I tried to send an email containing a large enclosure. Too large to send > and > now the message is stuck in my outbox. How do I delete the message? I > have >...

Format Cells Dialog Box has disapeared
My Format Cells Dialog Box has disapeared from my toolbar. This is the box where you can retype cell contents or see formulas, etc. have a look at tools, options, show and see if formula bar is checked -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 97 & 2000 ** remove news from my email address to reply by email ** <anonymous@discussions.microsoft.com> wrote in message news:fe3701c43ea1$1d6ebd70$a001280a@phx.gbl... > My Format Cells D...

Is a Drop Down box the best function to use?
I have a worksheet template that I want use for 70 different countries. I am trying to figure out a way that allows me to choose and then fill out the template for a chosen country without having to create 70 worksheets. ie. I don't want to create a mother of a file. Can I somehow incorporate a drop down box or something similar which allows me to do this? Hi Have a look at Data|Validation. Using this you can create a drop-down box and link the list to a range of cells. Andy. "Ant" <Ant@discussions.microsoft.com> wrote in message news:D7518745-F8C1-4FE3-ACB7-5E7B4...