 |
 |

02-13-2003, 12:06 PM
|
|
|
Problems with VB and Access 2002
|
I have an application that runs with an Access 2002 DB, I want to grab the data from two field inside one table. The database is on a network drive z:\dictation\Data\pathist.mdb. I want to list the data inside a listbox. Is there a problem with VB 6 and access 2002. Granted I am very new to VB but I have followed the steps in 2 different books on connecting to an Access DB and I can not get it do work. Some direction would be wonderful.
I can connect to access 97 DB but I am still unable to get the data to display in a list box.
I get the error:
Unrecognized database format "dir of database"
This happens when I try my database verses the northwind database.
If I use the northwind I can display information in a text box but nothing shows in the list box and when I change the DB I get the above error.
Q
|
Last edited by Jquiz; 02-13-2003 at 12:16 PM.
|

02-13-2003, 01:25 PM
|
 |
Junior Contributor
|
|
Join Date: Jan 2003
Location: PA
Posts: 312
|
|
|
You cannont connect to an access 2000 or later database using dao, which, if you were connecting to a 97 database, is probably what you were using. You need to connect with ado, using jet 4.0
|
__________________
"Never explain--your friends do not need it and your enemies will not believe you anyway."
Elbert Hubbard (1856 - 1915)
|

02-13-2003, 01:32 PM
|
|
|
|
I am using the ADODC control and I can connect but I can not display information in a listBox.
I can get data into a text box, What I want to do is display the first and last names, which are seperate fields in the table. I have gotten as far as trying to concatenate the data from each text boxes into one but I haven't gotten that far yet. It would be so much easier if I could get the data from both fields to display inside a list box.
It's rather frustrating, this should work. I am baffled.
Q
|
|

02-13-2003, 01:48 PM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,885
|
|
|
Update your version of VB6 to Service Pack 5
|
|

02-13-2003, 01:51 PM
|
|
|
|
I did that an hour ago but I will reapply the service pack.
Q
|
|

02-13-2003, 02:30 PM
|
 |
Junior Contributor
|
|
Join Date: Jan 2003
Location: PA
Posts: 312
|
|
|
list1.additem adodc1.recordset.fields("FirstName") & " " & adodc1.recordset.fields("LastName")
|
__________________
"Never explain--your friends do not need it and your enemies will not believe you anyway."
Elbert Hubbard (1856 - 1915)
|

02-13-2003, 04:07 PM
|
|
|
|
Hey thanks that got the recods into the list box, but I am still unable to move the record from the list box to the text box. Here is the code I am using ...
Private Sub OKButton_Click()
lstPtnm1.additem adodc1.recordset.fields("First_Name") & " " & adodc1.recodset.fields("Last_Name")
If lstPtnm1.ListIndex = 0 Then
YellowSheet.txtPtNm.Text = " "
Else
YellowSheet.txtPtNm.Text = lstPtnm1.List(lstPtnm1.ListIndex)
End If
End Sub
YellowSheet is the name of the form with the text box named txtPtNm
lstPtnm1 is the list box where the records from your code go, this is on form Dialog
I can run the program with this code and I don't get an error but I also don't get any data moving from the list box to the text box.
any suggestions?
Q
|
|

02-14-2003, 08:19 AM
|
 |
Junior Contributor
|
|
Join Date: Jan 2003
Location: PA
Posts: 312
|
|
|
Dim c As Long
c = InStr(1, List1.Text, " ") ' <~ Here we find the space in the listbox text
Text1.Text = Left(List1.Text, c - 1)' <~ Populate text1 with the text to the left of the space
Text2.Text = Right(List1.Text, c + 1)' <~ Populate text2 with the text to the right of the space
Maybe this will help.
|
__________________
"Never explain--your friends do not need it and your enemies will not believe you anyway."
Elbert Hubbard (1856 - 1915)
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|