1

Topic: Help. Prompt, where I was mistaken.

There is a form, in it the subordinate form.
On the form I made the line delete button in the subordinate form, attached procedure:
[code]
Dim stSQl As String
If IsNull (Me! [The Code]) Then Exit Sub
If MsgBox ("Confirm record removal" and Me! [The Code].Value, vbYesNo + vbDefaultButton2, "Record will be remote") = vbYes Then
stSQl = "DELETE [code].*" And "FROM [code]" and "WHERE ((([Dannye_podch_prib]. [The Code]) =" and Me! [code].Value and "))"
CurrentDb. Execute (stSQl)
Me! [code].Requery
End If
End Sub
[/code]
Produces an error
CurrentDb. Execute (stSQl)

2

Re: Help. Prompt, where I was mistaken.

It not an error, and code line in which it arises.

3

Re: Help. Prompt, where I was mistaken.

Wawan2005;
P. SQL for record removal if the code number, should look somehow so:

strSQL = "DELETE * FROM tblName WHERE the Code =" and Me.

4

Re: Help. Prompt, where I was mistaken.

And why it is impossible to select stupidly record and to push "Delete"

5

Re: Help. Prompt, where I was mistaken.

Wawan2005;
At you it seems that the table has a name [Code] and a field in it too [Code]
I try not to admit the similar

6

Re: Help. Prompt, where I was mistaken.

That is not present, in condition WHERE it simply confused in places a title of the table and a field title. At it [code]
[__]. [code] = "and Me! [code].Value
[/code] and should be [code]
[code]. [__] = "and Me! [code].Value
[/code]

7

Re: Help. Prompt, where I was mistaken.

Joss wrote:

That is not present, in condition WHERE it simply confused in places a title of the table and a field title. At it [code]
[__]. [code] = "and Me! [code].Value
[/code] and should be [code]
[code]. [__] = "and Me! [code].Value
[/code]

is faster, so: [code]
stSQl = "DELETE * FROM [__] WHERE the Code =" and Me! The code
[/code]

8

Re: Help. Prompt, where I was mistaken.

I apologize for absence, out of it is necessary to delete all the line long on which there is a cursor in  [__]

9

Re: Help. Prompt, where I was mistaken.

hm-m-m;
All the same the same error

10

Re: Help. Prompt, where I was mistaken.

Joss;
The same error

11

Re: Help. Prompt, where I was mistaken.

Wawan2005 wrote:

hm-m-m;
All the same the same error

What statement of an error?
Try so:

stSQl = "DELETE * FROM [__] WHERE the Code =" and ImjaPodchinennojFormy.Form.Kod

Instead of ImjaPodchinennojFormy deliver the necessary name.

12

Re: Help. Prompt, where I was mistaken.

hm-m-m;
Thanks for the answer, but I went on other way, I in the subordinate form at line created the button and as result what button you will push, that line and is deleted.

13

Re: Help. Prompt, where I was mistaken.

hm-m-m;
But I all the same will try to check up your method, on later.

14

Re: Help. Prompt, where I was mistaken.

Brackets superfluous. Also add error handling

CurrentDb. Execute stSQl, dbFailOnError

15

Re: Help. Prompt, where I was mistaken.

And you did not tell till now, which error arises. In initial SQL there are appreciable errors, they were mentioned already. A field what Code of type? If the text inverted commas are necessary.

16

Re: Help. Prompt, where I was mistaken.

MrShin;
Simply selects yellow, all the line long.
Only at present not so actually I made in another way, the button created immediately in the subordinate form and all earned.