error message on naming subform

M

Michell Vandell

i have a form where you need to enter a name in a field which, at some point
generates a warning. when this warning appears you have to click a button to
check how many times this name appears in the databse. this button activates
a subform in the forms footer area and at the same time an error message that
the used form name is not according to the Microsoft Access naming convention.

the name is : subformulier_naamgast (this is dutch for subform_.....)

after having checked the naming convention i don't see what i have done wrong.

thanks for helping met out.

regards,

Michell van Andel
 
M

Michell Vandell

Hi Maurice,

here's my code:

Private Sub checkNaam_Click()
On Error GoTo Err_checkNaam_Click

Dim stDocName As String, stquery As String
stquery = "SELECT id, datum, perscode, sponsorkaart, voorlgast,
tussengast, achtergast, handicap, homeclub, bedrag " & _
"FROM invoer WHERE achtergast=me.achtergast "
Me.Subformulier_naamgast.Visible = True
Me.Subformulier_naamgast.SourceObject = stquery


Exit_checkNaam_Click:
Exit Sub

Err_checkNaam_Click:
MsgBox Err.Description
Resume Exit_checkNaam_Click

End Sub

thanks for helping.

rgds

Michell
 
M

Maurice

Hi Michell,

Your stquery is causing the problem. You have to close the statement before
you can parametize it.

Try the following:

stquery = "SELECT id, datum, perscode, sponsorkaart, voorlgast,
tussengast, achtergast, handicap, homeclub, bedrag " & _
"FROM invoer WHERE achtergast= '" & me.achtergast "'"

after the WHERE achtergast= there is a single quote and a double quote
(enkele apostroph en dubbele aanhalingsteken) and after the me.achtergast is
a double quote, single quote and a double quote again (dus dubbele, enkele en
een dubbele aanhalingsteken).

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top