Hi VB'ers
I just discovered something I thought I would pass along. Of course I'm probably the last one in the world to realize this but here goes.
I was getting the msg:
insufficient key column information for updating and refreshing.
I was loading combo boxes which I learned how to do on Tek Tips thank you very much. Well I decided to get fancy and try and load two combos at once. I am building an Application form and a few of the combo options that apply to the applicant also apply to the spouse (ie. sex). So I figured what the HEY since they are coming from the same table I'll load the Applicants combo and the Spouse's all at the same time. WRONG!!
As proof of my dum-dum move here is the code:
Public Sub LoadCombos()
Dim adoCombo As ADODB.Connection
Dim adoRec As ADODB.Recordset
Dim adoRS4 As ADODB.Recordset
Dim adoRS5 As ADODB.Recordset
Dim conString As String
Dim sCode As String
Dim sElig As String
Dim sElig2 As String
Dim sNeed As String
Dim sNeed2 As String
Set adoCombo = New ADODB.Connection
Set adoRec = New ADODB.Recordset
Set adoRS4 = New ADODB.Recordset
Set adoRS5 = New ADODB.Recordset
conString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data source= C:\VB Practice\zGDS_Data_V6_1_2k.mdb"
'LOAD PROGRAM CODES
adoComb
pen conString
adoRec.Open "[Program Codes]", adoCombo
sCode = cboPgmCode
Do Until adoRec.EOF
cboPgmCode.AddItem (adoRec!pgm_code & " " & adoRec!pgm_code_names)
adoRec.MoveNext
Loop
cboPgmCode = sCode
'LOAD Eligibility CODES
adoRS4.Open "[Eligibility]", adoCombo
sElig = cboEligibility
sElig2 = cboElig2 '
Do Until adoRS4.EOF
cboEligibility.AddItem (adoRS4!Eligibility)
' cboElig2.AddItem (adoRS4!Eligibility)
adoRS4.MoveNext
Loop
cboEligibility = sElig
cboElig2 = sElig2
'LOAD Need CODES
adoRS5.Open "[Needs]", adoCombo
sNeed = cboNeed
sNeed2 = cboNeed2
Do Until adoRS5.EOF
cboNeed.AddItem (adoRS5!need)
' cboNeed2.AddItem (adoRS5!need)
adoRS5.MoveNext
Loop
cboNeed = sNeed
cboNeed2 = sNeed2
adoRec.Close
adoRS4.Close
adoRS5.Close
Set adoRec = Nothing
Set adoRS4 = Nothing
Set adoRS5 = Nothing
End Sub
Just thought I would pass that a long, I hope this helps someone.
Trudye
I just discovered something I thought I would pass along. Of course I'm probably the last one in the world to realize this but here goes.
I was getting the msg:
insufficient key column information for updating and refreshing.
I was loading combo boxes which I learned how to do on Tek Tips thank you very much. Well I decided to get fancy and try and load two combos at once. I am building an Application form and a few of the combo options that apply to the applicant also apply to the spouse (ie. sex). So I figured what the HEY since they are coming from the same table I'll load the Applicants combo and the Spouse's all at the same time. WRONG!!
As proof of my dum-dum move here is the code:
Public Sub LoadCombos()
Dim adoCombo As ADODB.Connection
Dim adoRec As ADODB.Recordset
Dim adoRS4 As ADODB.Recordset
Dim adoRS5 As ADODB.Recordset
Dim conString As String
Dim sCode As String
Dim sElig As String
Dim sElig2 As String
Dim sNeed As String
Dim sNeed2 As String
Set adoCombo = New ADODB.Connection
Set adoRec = New ADODB.Recordset
Set adoRS4 = New ADODB.Recordset
Set adoRS5 = New ADODB.Recordset
conString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data source= C:\VB Practice\zGDS_Data_V6_1_2k.mdb"
'LOAD PROGRAM CODES
adoComb
adoRec.Open "[Program Codes]", adoCombo
sCode = cboPgmCode
Do Until adoRec.EOF
cboPgmCode.AddItem (adoRec!pgm_code & " " & adoRec!pgm_code_names)
adoRec.MoveNext
Loop
cboPgmCode = sCode
'LOAD Eligibility CODES
adoRS4.Open "[Eligibility]", adoCombo
sElig = cboEligibility
sElig2 = cboElig2 '
Do Until adoRS4.EOF
cboEligibility.AddItem (adoRS4!Eligibility)
' cboElig2.AddItem (adoRS4!Eligibility)
adoRS4.MoveNext
Loop
cboEligibility = sElig
cboElig2 = sElig2
'LOAD Need CODES
adoRS5.Open "[Needs]", adoCombo
sNeed = cboNeed
sNeed2 = cboNeed2
Do Until adoRS5.EOF
cboNeed.AddItem (adoRS5!need)
' cboNeed2.AddItem (adoRS5!need)
adoRS5.MoveNext
Loop
cboNeed = sNeed
cboNeed2 = sNeed2
adoRec.Close
adoRS4.Close
adoRS5.Close
Set adoRec = Nothing
Set adoRS4 = Nothing
Set adoRS5 = Nothing
End Sub
Just thought I would pass that a long, I hope this helps someone.
Trudye