Can anyone help me? I am using a popup menu and would like to add data from the form into mysql database when I click the save button. I am using visual basic 6 with mysql version 5.0. This is the code below. Visual basic complains about the save item on the code line 'Adodc1.Recordset.Addnew. I get the error message "Cannot jump to 'AddNew' because it is hidden" However I use the same line of code to update fields in the modify command and that works fine.
Private Sub Command2_Click() If Command2.Caption = "Options" Then PopupMenu mnuPopup, 1, (Command2.Left), (Command2.Top + Command2.Height), mnuAdd ElseIf Command2.Caption = "Modify" Then Call ModifyItem ElseIf Command2.Caption = "Save" Then Call SaveItem End If End Sub Private Sub mnuAdd_Click() Command2.Caption = "Save" Call SaveItem End Sub Private Sub SaveItem() If txtFields(15) = "" Then MsgBox "Application ID Should Not Be Blank", , "ApplicationID" End If Adodc1.Recordset.AddNew Exit Sub End Sub Modify Command. Private Sub mnuModify_Click() Command2.Caption = "Modify" End Sub Private Sub ModifyItem() If txtFields(1) = "" Then Exit Sub Adodc1.Recordset.UpdateBatch MsgBox "Details Modified Successfully.", , "Modify" Command2.Caption = "Options" End Sub
Regards
Vanita

Ask A New Question
Reply





MultiQuote




|