| | |
Vbcombobox problem...........
![]() |
•
•
Join Date: May 2009
Posts: 5
Reputation:
Solved Threads: 0
I HAVE USED THREE COMBO BOXES IN AN APPLICATION
COUNTRYCOMBO,STATECOMBO,DISTRICT COMBO . THESE CONTAINS THE ITEMS FROM A TABLE .COUNTRY COMBO IS FILLED IN THE FORM LOAD EVENT. STATE COMBO IS FILLED IN THE CLICK EVENT OF COUNTRY COMBO . DISTRICT COMBO IS FILLED IN THE CLICK EVENT OF STATE COMBO . STYLE PROPERT OF THE COMBO BOX IS 2. BUT WHEN I'M RETRIEVING THE VALUES FROM THE TABLE TO THE COMBOBOX RUNTIME ERROR 91 OCCURS.
<CODE> For intX = 0 To cmbCountry.ListCount - 1
If UCase$(myrs!country) = UCase$(cmbCountry.List(intX)) Then
cmbCountry.ListIndex = intX
Exit For
End If
Next </CODE>
PLS HELP ME .......... THNKS IN ADVANCE..........
COUNTRYCOMBO,STATECOMBO,DISTRICT COMBO . THESE CONTAINS THE ITEMS FROM A TABLE .COUNTRY COMBO IS FILLED IN THE FORM LOAD EVENT. STATE COMBO IS FILLED IN THE CLICK EVENT OF COUNTRY COMBO . DISTRICT COMBO IS FILLED IN THE CLICK EVENT OF STATE COMBO . STYLE PROPERT OF THE COMBO BOX IS 2. BUT WHEN I'M RETRIEVING THE VALUES FROM THE TABLE TO THE COMBOBOX RUNTIME ERROR 91 OCCURS.
<CODE> For intX = 0 To cmbCountry.ListCount - 1
If UCase$(myrs!country) = UCase$(cmbCountry.List(intX)) Then
cmbCountry.ListIndex = intX
Exit For
End If
Next </CODE>
PLS HELP ME .......... THNKS IN ADVANCE..........
•
•
Join Date: Mar 2009
Posts: 821
Reputation:
Solved Threads: 150
Yeah, if your looking for a specific unique identifier based upon the text of the combo box that the user selected and your database has been normalized and you have defined the relational fields then...
Good Luck
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub ComboCountry_Click() SQL = "SELECT tblState.State, FROM tblState INNER JOIN tblCountry.iCountryID = tblState.iCountryID WHERE tblCountry.vCountry = '" & comboCountry.Text & "'" '....execute query, loop through RS to populate comboState... End Sub
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
•
•
Join Date: May 2009
Posts: 372
Reputation:
Solved Threads: 26
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
'dim strings and integers where possible. Don't use actual references. Dim strMyCountry, strCountryBox. strCombo Dim intX as integer For intX = 0 To cmbCountry.ListCount -1 strMyCountry=myrs!country strCountryBox=cmbCountry.List(intX) strCombo=cmbCountry.List(intX) If UCase$(strMyCountry) = UCase$(strCombo) Then cmbCountry.text=cmbCountry.List(cmbCountry.List(intX)) Exit For End If Next
Last edited by Jupiter 2; May 23rd, 2009 at 9:36 am. Reason: Brackets for Code Tags
in what line did the error occured?
Does the error occurs here? cmbCountry.List(intX). Sorry I have no VB4/5/6 here... Is it List or Item? like cmbCountry.Item(intX).
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
For intX = 0 To cmbCountry.ListCount - 1 If UCase$(myrs!country) = UCase$(cmbCountry.List(intX)) Then cmbCountry.ListIndex = intX Exit For End If Next
Does the error occurs here? cmbCountry.List(intX). Sorry I have no VB4/5/6 here... Is it List or Item? like cmbCountry.Item(intX).
Last edited by jireh; May 25th, 2009 at 5:38 am.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to determine when command button is clicked
- Next Thread: reading data using serial port
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






