|
-
May 4th, 2000, 03:14 PM
#1
Thread Starter
Lively Member
I can fill a datacombo at design time using adodc but not at runtime using the code below. The recordset has records in (i've checked using the immediate pane), but no records are displayed in the datacombo itself.
Option Explicit
Private Sub Form_Click()
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.Open "Select * from career_officers", _
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CSRSRep;Data Source=DEVSRV1"
Set DataCombo1.RowSource = myrs
DataCombo1.ListField = "name"
End Sub
-
Aug 22nd, 2001, 02:10 AM
#2
Hi Frank
I am also having the same problem if you have found the problem then please forward to me also.
bye
sajid
-
Aug 22nd, 2001, 05:10 AM
#3
Addicted Member
Hi guys. Seems like the ADO ain't that great, huh? Well, I am sure it is after you really find out how to use it. I had similar problems with datacombo a year ago and never really solved it. So I think this will not help you but ... you never know.
So in the project I was working on I had a ADOdatacombo that displayed values (let's say names). On the same form there was an option to add a new name. It was added into the database and NOW, believe I tried everything from a simple combo requery or refresh, changing datasource (SQL) all the means of refreshing the Data environmenet and guess what ... the new record wasn't there. Suprisingly enough it appeared but AFTER I UNLOADED AND THEN RELOADED the entire form again -> so what do you think? I have no idea because I see no links between un/loading the form and DataEnv.
Anyway if you are wondering how I solved it afterwards /nobody here could help me / it was quite simple -> forgot about ADO and all the "simple and unified ways of accessing datas" and switched back to DAO. Little more code, maybe little slower but more than that - IT WORKED!
-
Aug 22nd, 2001, 05:13 AM
#4
Addicted Member
Just to make myself clear -> by saying the record wasn't there I mean it's been added to database and was in the table but no-way to get him to the combo.
-
Aug 22nd, 2001, 04:14 PM
#5
New Member
Is this a People Soft thing?
-
Aug 22nd, 2001, 04:48 PM
#6
New Member
First of all, why NOT use the ADODC ? The combo could still be refreshed as you wanted.. I'm sure you can populate the DataCOmbo progmatically. but i've not been able to figure it out myself( quell suprise!). Also, why not use a regular combo and just populate it with your recordset? Alternatively, create an active x control..
-
Aug 22nd, 2001, 06:08 PM
#7
It looks like it didn't work because you of the cursor type:
Try this:
VB Code:
Option Explicit
Private Sub Form_Click()
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.Open "Select * from career_officers", _
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CSRSRep;Data Source=DEVSRV1", adOpenKeyset, adLockOptimistic
Set DataCombo1.RowSource = myrs
DataCombo1.ListField = "name"
End Sub
-
Sep 15th, 2002, 08:34 AM
#8
New Member
filling datacombo boxes
check out this page for the right fields to use: http://support.microsoft.com/default...9682&ID=189682
I noticed that the combo box fills only if using a static curser, not a dynamic cursor (on the MSDE engine any way!)
for example, generate the recordset like this:
rsPtStatus.Open SQL, conDB, adOpenStatic
not like this...
rsPtStatus.Open SQL, conDB, adOpenDynamic
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|