473,413 Members | 1,789 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,413 software developers and data experts.

Combo Box Problems

I'm trying to populate a combo box using the following code:

Expand|Select|Wrap|Line Numbers
  1.     Do Until rs.EOF
  2.         strComVal = rs!clnt_LastName
  3.         cbxSearch.AddItem (strComVal)
  4.         rs.MoveNext
  5.     Loop 
  6.  
  7.  
My problem is when it hits .EOF rather than exiting the Loop it tries to go through and throws an error NO current record. Why won't it stop?
Jan 5 '07 #1
4 1322
hariharanmca
1,977 1GB
I'm trying to populate a combo box using the following code:

Expand|Select|Wrap|Line Numbers
  1.     Do Until rs.EOF
  2.         strComVal = rs!clnt_LastName
  3.         cbxSearch.AddItem (strComVal)
  4.         rs.MoveNext
  5.     Loop 
  6.  
  7.  
My problem is when it hits .EOF rather than exiting the Loop it tries to go through and throws an error NO current record. Why won't it stop?


Try this

while rs.EOF=false
strComVal = rs!clnt_LastName
cbxSearch.AddItem (strComVal)
rs.MoveNext
wend
Jan 6 '07 #2
hariharanmca
1,977 1GB
I'm trying to populate a combo box using the following code:

Expand|Select|Wrap|Line Numbers
  1.     Do Until rs.EOF
  2.         strComVal = rs!clnt_LastName
  3.         cbxSearch.AddItem (strComVal)
  4.         rs.MoveNext
  5.     Loop 
  6.  
  7.  
My problem is when it hits .EOF rather than exiting the Loop it tries to go through and throws an error NO current record. Why won't it stop?

Why you are not specifying any index value for any item it’s not so important but anyway it’s better to avoid one more query to fetch the index of each item.
Jan 6 '07 #3
Try this

while rs.EOF=false
strComVal = rs!clnt_LastName
cbxSearch.AddItem (strComVal)
rs.MoveNext
wend
Tried that and got the same error as the original code. I [i]did[i] get it to work using
Expand|Select|Wrap|Line Numbers
  1. intRecNum = rs.RecordCount - 1
  2. For intCnt = 0 To intRecNum
  3.                     strComVal = rs!clnt_LastName & "," & rs!clnt_FirstName
  4.                     cbxSearch.AddItem (strComVal)
  5.                     rs.MoveNext
  6. Next
Thanks for trying
Jan 8 '07 #4
hariharanmca
1,977 1GB
Tried that and got the same error as the original code. I [i]did[i] get it to work using
Expand|Select|Wrap|Line Numbers
  1. intRecNum = rs.RecordCount - 1
  2. For intCnt = 0 To intRecNum
  3.                     strComVal = rs!clnt_LastName & "," & rs!clnt_FirstName
  4.                     cbxSearch.AddItem (strComVal)
  5.                     rs.MoveNext
  6. Next
Thanks for trying
what error you are geting exactly
Jan 9 '07 #5

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

Similar topics

1
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
1
by: meganrobertson22 | last post by:
Hi Everyone- I am trying to use a simple macro to set the value of a combo box on a form, and I can't get it to work. I have a macro with 2 actions: OpenForm and SetValue. I can open my form,...
2
by: Jason Huang | last post by:
Hi, Would someone tell me how to fill a dataset into a Combo Box? I need the ComboBox by default to show the first DataRow from the dataTable. Thanks for help. Jason
6
by: vb | last post by:
Hi, I am new to .Net. I am using a Combo Box in my windows forms. I am adding the items by creating the instances and adding the same to the list. My questions/doubts are: 1. If I have 25 to...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
9
by: Duncan Barnes-Ceeney | last post by:
I’m having problems with a custom Combo box. The main problem is that I want to modify the look of the combo which includes the size of the button. To do this I have inherited from the standard...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
4
by: deanndra | last post by:
First, I want to say thank you to Scott and the others who replied to my first post here. I had to put that database on hold for the moment when I was tasked with a new one. I am building another...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.