AccessDiscussion 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
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?
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
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