woody999
10-30-2004, 09:29 AM
Hi
I am trying to use a DataCombo t0 display a field from a table. Ia m using this code:
Private Sub DataCombo1_Click(Area As Integer)
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Winsys\Visual Basic\My Programs\VB6 Sailing Boat Project\Boat Race.mdb;"
Set rs = New Recordset
rs.Open "select classname from classes", db, adOpenStatic, adLockOptimistic
With DataCombo1
Set .RowSource = rs
.ListField = "classname"
.BoundColumn = "classname"
End With
End Sub
It displays the fields but when I try to add a new record I get this message:
"The field ClassID cannot contain a null value". I'm guessing it's because it's not bound to the classID field. How can I do this?
I am trying to use a DataCombo t0 display a field from a table. Ia m using this code:
Private Sub DataCombo1_Click(Area As Integer)
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Winsys\Visual Basic\My Programs\VB6 Sailing Boat Project\Boat Race.mdb;"
Set rs = New Recordset
rs.Open "select classname from classes", db, adOpenStatic, adLockOptimistic
With DataCombo1
Set .RowSource = rs
.ListField = "classname"
.BoundColumn = "classname"
End With
End Sub
It displays the fields but when I try to add a new record I get this message:
"The field ClassID cannot contain a null value". I'm guessing it's because it's not bound to the classID field. How can I do this?