Link to home
Start Free TrialLog in
Avatar of TungVan
TungVan

asked on

Create a recordset in DAO under VB6 environment


Hi,

I have a table called Button. It has the following fields: ButtonType, CControl_ControlLabel, CControl_Height, CControl_Width.

I want to create a recordset, to later insert it into that table.

mDAORecordSet.Fields.Append "ButtonType", adVarChar, 255, adFldUpdatable
mDAORecordSet.Fields.Append "CControl_ControlLabel", adVarChar, 255, adFldUpdatable
mDAORecordSet.Fields.Append "CControl_Height", adInteger, , adFldKeyColumn
mDAORecordSet.Fields.Append "CControl_Width", adInteger, , adFldKeyColumn
mDAORecordSet.OpenRecordset

mDAORecordSet.AddNew
  mDAORecordSet!ButtonType = "Admin"
  mDAORecordSet!CControl_ControlLabel = "No"
  mDAORecordSet.Update
Next


But I have "type mistmatch" error at "ButtonType"


Thanks for any help
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

You probably need to refresh the tables collection between creating the table and actually referencing it.  
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial