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

I don't know why I get a type mismatch( cmbcountry.AddItem rs.Fields(0) )

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click()
  2. strSQL = "Select Distinct [Country] From [Data$] Order by [Country]"
  3.     closeRS
  4.     OpenDB
  5.     cmbcountry.Clear
  6.  
  7.     rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
  8.     If rs.RecordCount > 0 Then
  9.         Do While Not rs.EOF
  10.             cmbcountry.AddItem rs.Fields(0)
  11.             rs.MoveNext
  12.         Loop
  13.     Else
  14.         MsgBox "I was not able to find any unique Country.", vbCritical + vbOKOnly
  15.         Exit Sub
  16.     End If
I'm doing a database using VB-SQL thru MS excel... I dont know why I always get a type mismatch...
Feb 18 '14 #1
0 1124

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

Similar topics

2
by: shank | last post by:
What is the proper use for CInt ..? I get a type mismatch error whether I use it or not. I assumed I needed it because I need to make sure Request("Qty") and Request("Weight") were integers. ...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
5
by: Paul | last post by:
Hello, i an not sure if this is the rihgt place for this question, if not could someome point me to the correct newsgroup please. For a number of years i have been designing sites and hosting...
4
by: N J | last post by:
Hi, CurrentDb.Execute "Update tblDelayedOrders Set DELAYED = True Where ID = " & Me.txtOrderNumber & ";", dbfailonerror Me.StatusListBox.AddItem "ORDER # " & Me.txtOrderNumber & " MARKED AS...
3
by: john | last post by:
I have a situation where i have a base class and a sub-class. A null instance of the sub-class is passed into a function. The function needs to create a new instance of the sub-class, but the...
2
by: Rehan | last post by:
Hi there! Please help me out here. I am an inch away from completing my assignment. I am very new to VBA but i have very less time to be efficient at it. I am getting a type mismatch error...
2
by: THEAF | last post by:
i'm using this for my list box: Private Sub lstStock_Click() ' rsMyRS.FindFirst "Stockcode=" & Str(lstStock.ItemData(lstStock.ListIndex)) txtCode.Text = rsMyRS!Stockcode optVegi.Value...
1
by: THEAF | last post by:
hi, i'm creating a search button. When i click the button an input box shows up where i then enter the name of the employee and the result is show on a list box. Im using vb 6 and access. my form...
1
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: ...
1
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: __________________________________________________...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...

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.