Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2003, 03:27 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How many times is the Do loop being executed?


Sal
 
Old October 14th, 2003, 03:24 PM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by sal
 How many times is the Do loop being executed?


Sal
Only once I checked all the code and it's fine it might be the form's properties. I cannot think of anything else

slypunk
 
Old October 15th, 2003, 09:40 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On this code
'Get contract Number
Form_frmEnterContNo.lstContNo.SetFocus
strContNo = Form_frmEnterContNo.lstContNo.ItemData(Form_frmEnt erContNo.lstContNo.ListIndex) & "'"

Do not use .ListIndex The index is the zero based value for an array. Use .value and make sure that you are setting the value of the combo box (or list box) to the contract number.
What is the contract numberbeing selected? which contrct number is being deleted?



Sal
 
Old October 15th, 2003, 12:36 PM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by sal
 On this code
'Get contract Number
Form_frmEnterContNo.lstContNo.SetFocus
strContNo = Form_frmEnterContNo.lstContNo.ItemData(Form_frmEnt erContNo.lstContNo.ListIndex) & "'"

Do not use .ListIndex The index is the zero based value for an array. Use .value and make sure that you are setting the value of the combo box (or list box) to the contract number.
What is the contract numberbeing selected? which contrct number is being deleted?


The user has the option of adding contract numbers and deleting contract numbers. He/she may wish to delete any contract number they want by selecting it from the listbox and then hitting delete.
I switched the code from .ListIndex to .Value like you said but it gives me an error of invalid use of null. This is an example of a contract number (e.g. S-746; W-846; ER-47620....) Thank you



Sal
slypunk
 
Old October 15th, 2003, 01:20 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

a value must be selected in the list box for this to run.


Sal
 
Old October 20th, 2003, 09:42 AM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by sal
 a value must be selected in the list box for this to run.


Sal
Thank you for your help I'll let you know how it goes. :D

slypunk
 
Old October 20th, 2003, 10:37 AM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

YES! I finally figured out what the problem was. In the listbox properties the Control Source was supposed to be left blank I accidently chose the ContractNo field that is why is was deleting the first record. Thank you very much for your help! :D

slypunk
 
Old October 20th, 2003, 10:51 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great!!!!!!

I am glad it worked, even if I was not much help.
Some times we forget the simplest things. Take care.


Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete a piece of code Charlie05 C# 2005 2 August 3rd, 2008 11:32 AM
Delete MS Access Foreign Key from Code pkipe Access 3 February 21st, 2006 06:45 PM
pg190 edit/delete code for 'people' table ?? jeronimo BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 June 28th, 2004 01:29 AM
Urgent: Implement Cascade Delete through Code rcmetta BOOK: Professional Crystal Reports for VS.NET 0 June 7th, 2004 12:49 AM
delete problem hosefo81 PHP Databases 1 March 7th, 2004 07:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.