Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding information to a ComboBox in Visual Basic

Status
Not open for further replies.

InfilcoLee

Technical User
Aug 25, 2010
2
US
I currently have a table in Microsoft access that I am trying to pull data from and then put into a ComboBox in Visual Basic. The following code is taken from a training manual that I am currently using. I am new to Visual Basic.

Dim rs As Object
Err.Clear
Dim sSql$
sSql = "SELECT NOMSPEC From NominalSpec WHERE(type = 'AT_Process')"
If Not gProjectDb.ExecuteSQL(sSql, rs) Then Exit Function
If rs Is Nothing Or rs.EOF Then Exit Function
Do While Not rs.EOF
cmbPspecNom.AddItem rs.Fields("NOMSPEC")
cmbPspecNom.Text = NominalSpec.Text
rs.MoveNext
Loop

I am getting a Compile Error when trying to write the .dll file. "Method or data Member not found". The error is referring to my line of code where I am using ".AddItem"

Some of the information in the code like "AT_Process, NominalSpec,and NOMSPEC refer to variables that are specific to what I am trying to implement.

Any suggestions?
 
You want forum705

In Access, you set the rowsource of the combo to the name of a table, a value list, or an SQL statement. AddItem will not work. Access uses VBA, which is similar to VB, but not the same.

 
I am not sure if I quite understand what you are explaining, but regardless, thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top