Hi,
A section of my database allows users to delete items from a table, there is only one collumn in the table, this contains module information(parts of a manufacturing line) due to the lines regulary changing i added a section to delete modules. so far ive got the combo box which selects the modules from a table using a select query, when a specific module is selected i need it to be deleted.
the problem im having is when the delete button is pressed it deletes the top item in the table not the one selected.
i tried resolving this so when the list box item is clicked whatever module has been selected gets put into an invisible text box on the form, and when the delete button is pressed it is supposed to delete whatever is in the text box but i am getting the same problem (deletes first item in table not the one selected)
here is the code that is used on the deleted button and combo box:
--------------------------------------------------------------------------------------------------
Private Sub cmddel_Click()
'Yes/No opetion box
RetValue = MsgBox("Are you sure you want to delete this module", vbOKCancel)
'if the value equals yes then module is deleted
If RetValue = 1 Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
cmbmodlookup.Requery
cmbmodlookup = ""
End If
End Sub
Private Sub cmbmodlookup_click()
DoCmd.ShowAllRecords
Me!txtmodule.SetFocus
DoCmd.FindRecord Me!cmbmodlookup
Me!cmbmodlookup.SetFocus
End Sub
--------------------------------------------------------------------------------------------------------------
any help or suggestions would be great