473,387 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Bound Combo box is Empty on selection of Null value on Exit Sub

Im a rookie.

I have am unbound combo box populated with values (rowsource) from a query which has 2 tables in it. Each table has its own ID, but both are included in the combo box (info3). Sometimes the combobox has ID values from Table A, but the corresponding ID value in table B is NULL. The bound column is the ID from B, because I use it to populate text boxes, by going to that record using:

strCriteria = "[ID] =" & Me.info3
Me.RecordsetClone.FindFirst strCriteria
Me.Bookmark = Me.RecordsetClone.Bookmark

I have a statement which checks if the info3 (the bound column is from Table B), is NULL.

If it is, it "does some things" and at the end, i have Exit Sub.

THE PROBLEM: When I select an item from the combo, with value for ID from Table A, but NULL (bound column) from Table B, it exits the Sub, and clears the selection from the combobox, as if its not selected.

If i step through the code, it "does some things", like updating text boxes, but when it gets to Exit Sub, it all disappears, blank values in the text boxes (does some stuff), and shows the combo box blank.

Why does this happen when the Exit Sub is executed ?

Another clue: When i do Debug.print of the text boxes being updated (stuff), it actually updates them, and does Not empty them upon Exit Sub. However, the combobox still goes blank.

PLEASE HELP. I give props to whoever can solve this. I been trying for 3 weeks, about 20 different ways.

Many many many thanks to the guru who understands this.
Attached Files
File Type: txt code.txt (1.6 KB, 471 views)
Jun 1 '10 #1
4 2736
Delerna
1,134 Expert 1GB
I can't make head or tail of that description.
You start out with
I have am unbound combo box .......
Sometimes the combobox has ID values from Table A, but the corresponding ID value in table B is NULL
and when you get to the problem you say

but NULL (bound column) from Table B
What ???? you lost me.

The one thing I did notice
Why does this happen when the Exit Sub is executed ?
I suspect you might have some code somewhere else that is getting executed after the Exit sub ?
Try breakpointing the exit sub and when the code stops there
breakpoint every line of code so you can follow the flow after that point
Jun 2 '10 #2
MMcCarthy
14,534 Expert Mod 8TB
If I understand you correctly, you are using the value in column 2 of the combobox as the bound column but this column can sometimes have Null value. What are you trying to bind that value to. Have you set a control source for the combobox. Prehaps a field that won't allow a null value.
Jun 2 '10 #3
Let me demonstrate a small example of my issue in the table below.

ID-A ID-B Name
1 23 First
2 26 Second
3 Null Third

The control source for the form is Table B, which has ID-B, since I want the Row source to move there with corresponding other text fields. I also have unbound text fields which use the corresponding ID-A field to fill corresponding information from Table A. The bound column (ID-B) may be Null as a result (as in the 3rd row in example above). I tried stepping through the code. All is good until the Exit Sub is executed.
Jun 6 '10 #4
MMcCarthy
14,534 Expert Mod 8TB
Without knowing the structure of these two tables and how you are coming up with the data set for the drop down box it's difficult to advise you. I suspect you are trying to do something with the unbound textboxes that you really can't do. Can you post the metadata of these two tables.

Here is an example of how to post table MetaData :
Table Name=tblBookings
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; Autonumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Also tell us the row source of the dropdown box. Is it a query? If so please post the sql.
Jun 10 '10 #5

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

Similar topics

0
by: Sandra Setz | last post by:
Hi, I have a continuous form with a combobox that gets its values from a table with no null values. For some reason, whenever I add a new record in the form, Access tries to look up the current...
0
by: Grant | last post by:
Hello, What do I do with a combo box if I have a null value? I have two tables linked in an access database - Table1 contains a column called "state" (integer) which is linked to Table2 which...
1
by: Adjo | last post by:
Okay, I've seen all the examples of using comboboxes on webforms when using simple values. And in the issue-tracker starterkit there is a way to use comboboxes with id/value foreign keys in a smart...
1
by: James | last post by:
I am used to VB6 but need to develop something in .Net. I need to create several bound combo-boxes which will use lookup tables to get their values. I created a form using the dataform wizard....
1
by: Bill | last post by:
Problem: Combo box data disappears from view when a requery is done See "Background" below for details on tables, forms & controls On a form, I want to use the setting of bound combo box C1...
9
by: Vmusic | last post by:
Hi, I'm using MS Access 2002. I have a form with a combo box built from a query that returns one column, and that one column is the bound column. How do you use VBA to programmatically change...
12
by: Aidan | last post by:
I have a form to create a new record for a training course. The form is based on one table that has 4 keys set to primary key. The first combo box on the form allows selection of the course POP...
7
by: kumar.senthil | last post by:
Hi, I'm using XmlSerializer to create an object from the XML string. I would like to know whether I can get a null value for an empty XML element. Actually the XmlSerializer assigns "" (empty...
1
by: zufie | last post by:
Hi, When I make a selection from the drop down list of values on a Combo Box. The Combo Box is on a Form. The Combo Box selection appears on ALL of the records. That is, when I select one...
4
by: Greg (codepug | last post by:
Private Sub cboBody_KeyDown(KeyCode As Integer, SHIFT As Integer) 'Delete combobox entry if Del or Backspace key is hit. If (KeyCode = 46) Or (KeyCode = 8) Then Me.cboBody = "" End Sub I have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.