Hi,
Help me to get the following program working..It is a simple example of a database
but I get a"Compile error" saying "User-defined type not defined" for the underlined lines below...
Could you please correct my code?
thanks...
VB Code:
Dim [U]rsMyRS As Recordset[/U] Dim dbMyDB As Database Private Sub cmdUpdate_Click() rsMyRS.Edit rsMyRS!Phone = txtPhone.Text rsMyRS.Update End Sub Private Sub cmdDelete_Click() rsMyRS.Delete lstRecords.RemoveItem lstRecords.ListIndex End Sub Private Sub cmdNew_Click() rsMyRS.AddNew rsMyRS!Name = "A New Person" lstRecords.AddItem rsMyRS!Name lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID rsMyRS!Phone = "Person's Phone Number" rsMyRS.Update End Sub Private Sub Form_Load() Set dbMyDB = OpenDatabase("C:\MyDatabase.mdb") Set rsMyRS = dbMyDB.OpenRecordSet("MyTable", dbOpenDynaset) If Not rsMyRS.EOF Then rsMyRS.MoveFirst Do While Not rsMyRS.EOF lstRecords.AddItem rsMyRS!Name lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID rsMyRS.MoveNext Loop End Sub Private Sub lstRecords_Click() rsMyRS.FindFirst "ID=" & Str(lstRecords.ItemData(lstRecords.ListIndex)) txtPhone.Text = rsMyRS!Phone End Sub


Reply With Quote