Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: How to: OnClose run Make Table Query

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

How to: OnClose run Make Table Query
Ember 06.09.2006 03:05:01
I have a form "Close" control. I have a Make Table Query that I would like
to be run when the close control is clicked. I keep getting an error that
and expected statment is missing, here is my code:

Private Sub cmdCloseFile_Click()
On Error GoTo Err_cmdCloseFile_Click

DoCmd.SetWarnings (WarningsOn)

Dim strSQL
strSQL = "SELECT (tblFiles.[Project Name], tblFiles.[Project Number],
tblFiles.[Project Manager]), INTO tblProjects FROM tblFiles GROUP BY GROUP BY
tblFiles.[Project Name], tblFiles.[Project Number], tblFiles.[Project
Manager]"
DoCmd.RunSQL SQL

DoCmd.Close

Exit_cmdCloseFile_Click:
Exit Sub

Err_cmdCloseFile_Click:
MsgBox Err.Description
Resume Exit_cmdCloseFile_Click

End Sub

Thanks for any help!
Ember
Re: How to: OnClose run Make Table Query
"J. Goddard" <jrgoddard[ at ]NO_cyberus_SPAM.ca> 06.09.2006 03:24:05
First, there should be no brackets around the field list following SELECT
Second - you have an extra comma before INTO
Third - you have GROUP BY twice

strSQL = "SELECT tblFiles.[Project Name], tblFiles.[Project Number],
tblFiles.[Project Manager] INTO tblProjects FROM tblFiles GROUP BY
tblFiles.[Project Name], tblFiles.[Project Number], tblFiles.[Project
Manager]"

John


Ember wrote:

[Quoted Text]
> I have a form "Close" control. I have a Make Table Query that I would like
> to be run when the close control is clicked. I keep getting an error that
> and expected statment is missing, here is my code:
>
> Private Sub cmdCloseFile_Click()
> On Error GoTo Err_cmdCloseFile_Click
>
> DoCmd.SetWarnings (WarningsOn)
>
> Dim strSQL
> strSQL = "SELECT (tblFiles.[Project Name], tblFiles.[Project Number],
> tblFiles.[Project Manager]), INTO tblProjects FROM tblFiles GROUP BY GROUP BY
> tblFiles.[Project Name], tblFiles.[Project Number], tblFiles.[Project
> Manager]"
> DoCmd.RunSQL SQL
>
> DoCmd.Close
>
> Exit_cmdCloseFile_Click:
> Exit Sub
>
> Err_cmdCloseFile_Click:
> MsgBox Err.Description
> Resume Exit_cmdCloseFile_Click
>
> End Sub
>
> Thanks for any help!
> Ember

Re: How to: OnClose run Make Table Query
Ember 06.09.2006 17:35:02
Thanks I will try it. I thought I was close...grammar was always my problem
in English class guess it still is. :)

Ember

"J. Goddard" wrote:

[Quoted Text]
> First, there should be no brackets around the field list following SELECT
> Second - you have an extra comma before INTO
> Third - you have GROUP BY twice
>
> strSQL = "SELECT tblFiles.[Project Name], tblFiles.[Project Number],
> tblFiles.[Project Manager] INTO tblProjects FROM tblFiles GROUP BY
> tblFiles.[Project Name], tblFiles.[Project Number], tblFiles.[Project
> Manager]"
>
> John
>
>
> Ember wrote:
>
> > I have a form "Close" control. I have a Make Table Query that I would like
> > to be run when the close control is clicked. I keep getting an error that
> > and expected statment is missing, here is my code:
> >
> > Private Sub cmdCloseFile_Click()
> > On Error GoTo Err_cmdCloseFile_Click
> >
> > DoCmd.SetWarnings (WarningsOn)
> >
> > Dim strSQL
> > strSQL = "SELECT (tblFiles.[Project Name], tblFiles.[Project Number],
> > tblFiles.[Project Manager]), INTO tblProjects FROM tblFiles GROUP BY GROUP BY
> > tblFiles.[Project Name], tblFiles.[Project Number], tblFiles.[Project
> > Manager]"
> > DoCmd.RunSQL SQL
> >
> > DoCmd.Close
> >
> > Exit_cmdCloseFile_Click:
> > Exit Sub
> >
> > Err_cmdCloseFile_Click:
> > MsgBox Err.Description
> > Resume Exit_cmdCloseFile_Click
> >
> > End Sub
> >
> > Thanks for any help!
> > Ember
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net