Well I guess the first point to make is that you would not be so off topic in the MyODBC list. I personally stay away from the "data" set of controls. I stick to manually loading recordsets into boxes, and thus avoid problems such as the one you point out. To do what you are doing, I would manually compare the entry to the recordset and take action accordingly. Something else to consider is that the add button will likely be what the users will be looking for, and may not think to type in something manually when they do not find what they are looking for in the combo box (I have gone against the grain, and in an enterprise environment you can always train to make sure the user knows what to expect, but what about when you cannot train the user?) Ultimately, my advice would be to switch to a regular combo box and handle the checks against the record set yourself, but that is just me. If you choose that course, feel free to e-mail me and I will see if I can help you work it out.
Mike Hillyer Dynamergy Software -----Original Message----- From: Tom Emerson [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 7:47 PM To: mySQL (E-mail) (E-mail) Subject: possibly off topic: any VB programmers out there? I've got a strange problem using VB to connect to a mysql database via ODBC. The problem isn't with connecting, but rather with one particular control -- the "datalist/combo" control. In fact, the "problem" doesn't seem to have anything to do with databases directly, BUT I figured that there is sufficient VB "talent" on this list that someone has seen this and knows how to "fix" it. (indirectly, I'm not able to reliably detect if a row exists or not using this control) Background: the "datacombo" control will automatically load itself with values taken from a dataset -- this is really cool for "lookup" fields where you want to make it easy for the end user to select related data. Being a "combo" type item, it ALSO allows the user to type in a completely NEW value, and that's where things seem to go downhill. In particular, the control has a property/field called "macthedwithlist" which returns true if the user selects or types in a value actually in the list, and another property called "selecteditem" which returns a "bookmark" [record number] of the selected value. This bookmark can then be applied to the related dataset to retrieve the full record for display or editing. The problem I'm running into is that if you TYPE IN the value directly (i.e., without using the mouse to point-n-click or the arrow keys to scroll through the list), the "bookmark" contains a "null" value EVEN IF THE USER TYPES IN A MATCHING ENTRY. (and here, a "null" bookmark would imply that the entered value doesn't match anything) What I'm trying to accomplish is to combine two activities into one logical activity -- for example, "inventory item maintenance". I want to build a form that allows editing of all the particulars for an inventory item (item code, description, qty, etc.) There are two (well, three) activities that can occur: a new item can be added, or an existing item can be modified (or deleted). The "traditional" way to do this would be to place an "add" button on the form to clear the form and allow an item to be defined, generating an annoying error if the user enters an existing "code" number. Likewise, you would place a "find" button that generates an equally annoying error if you DON'T type in the proper item code. What I want to do is combine these activities via the "combo" box -- if you select a existing item the form displays the data and allows for modifications. Likewise, if you type in a new value, the program implicitly "adds" a new (blank) record -- note that since I've determined from the "key" value entered whether to add or modify an entry, there is no need to display an "annoying error". The part my program falls over on is that if you TYPE in an EXISTING item code, the two tests that you can perform to see if this is a "new" entry generate conflicting values: "matchedwithlist" will return TRUE (meaning we should MODIFY the entry), and "selecteditem=null" also returns TRUE (which would indicate we need to ADD a new entry...) --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php