I have a popup form that when I delete this form I need it to delete data in one field in my master table that corresponds to the pop up record number. In the code below the number is 4838 and this code works fine as long as I put the correct number in. However, I want to get the number from the current pop up form and open up the table and delete the corresponding number in the master table. I indexed the field used <br>rec.index = "soldto"<br>rec.seek "=", soldto 'didn't work either<br><br>I can't get it to work how can I capture the number on my current popup and make it the value that my DAO statement will look up and delete.<br><br>Here is my code below.<br>Private Sub cmdDeleteSaveToNew_Click()<br>On Error GoTo Err_cmdDeleteSaveToNew_Click<br> Dim db As Database<br> Dim rec As Recordset<br> Dim strTable As String<br> <br> strTable = "tblMasterinfo"<br> <br> Set db = CurrentDb<br> Set rec = db.OpenRecordset(strTable, dbOpenDynaset)<br> <br> rec.FindFirst "[soldto] = 4838" 'right here I need code<br> rec.Edit<br> rec![SoldTo] = Null<br> rec.Update<br> rec.Close<br> <br> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70<br> DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70<br> <br>'These lines clean up the sold to drop down<br>'to reflect that it was deleted.<br> <br> If IsOpen("frmMasterinfo"
Then<br> Forms!frmMasterinfo.Refresh<br> Forms!frmMasterinfo.Command305.SetFocus<br> Forms!frmMasterinfo.cmdEditSoldto.Enabled = False<br> Forms!frmMasterinfo.cmdDeleteSoldToNew.Enabled = False<br> End If<br><br> Me.Requery<br> <br> Forms!frmSoldtoNew.SetFocus<br> DoCmd.Close<br> <br>Exit_cmdDeleteSaveToNew_Click:<br> Exit Sub<br><br>Err_cmdDeleteSaveToNew_Click:<br> MsgBox Err.Description<br> Resume Exit_cmdDeleteSaveToNew_Click<br> <br>End Sub