Compile Error, Method Or Data Member Not Found When Trying To Delete Record From Main

simsima

New member
Local time
Today, 15:25
Joined
Nov 25, 2015
Messages
2
Hi everyone,

I have a problem in access, I have main form which name BillDataMov and subform which name itemMov it is containg relationship between them, i want when the stock "which is in subform" = 0 then a the main form is closed and msgbox appear "that the stock is 0" and delete all the records which is in the main form and the sub form,i put the code in AfterUpdate Event (after i write item number which is in subform) i write this code but when i run it it's appear (compile Error, Method or data member not found).
please help me.

Private Sub item_no_IM_AfterUpdate()
If Me.STOCK = 0 Then
DoCmd.Close acForm, "BillDataMov_F", acSaveNo
MsgBox "The stock is 0"

Dim strSQL As String
strSQL = "DELETE * FROM [BillDataMov]" _
& "WHERE [Bill_no_BDM] = " & Me.Bill_no_BDM
CurrentDb.Execute strSQL, dbFailOnError
strSQL = "DELETE * FROM [itemMov]" & _
"WHERE [Bill_no_IM] = " & Me.Bill_no_IM
CurrentDb.Execute strSQL, dbFailOnError
End If

the problem is when i write (me.mainformtxtboxName) when i put (.) after (me) and searching for the txtbox which is in the main form its not appear at all only the txtbox that on subform is appear, why the txtbox which is in mainform no appear.

please help me
thank you
 

Attachments

  • ???? ????? (3).jpg
    ???? ????? (3).jpg
    97.5 KB · Views: 179
If the code is in the subform you need the full reference to a control on the main form:


Or the Parent syntax.

Sir,

First thank you for replay,

i applay what you said the error is gone but still the records don't deleted, i don't know why.

waiting for your replay
 

Users who are viewing this thread

Back
Top Bottom