One More Thing Comand "Email Inquiry Sent" Text to a button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Another Quick Question, OK This Works

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes) VALUES (" & Me.ID & ",
'Client Booked')"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

However, I also want to add the Date/Time to the Time Field, so I tried:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,Time) VALUES (" & Me.ID & ",
'Client Booked', " & Now() & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

Now I Get Run-Time error '3134'
Syntax error in Insert INTO Statement.

Any thoughts?
 
Date/Times need to be delimited with # characters (and need to be in
mm/dd/yyyy format, regardless of what your regional settings are). As well,
Time is a reserved word, and shouldn't really be used as a field name. If
you can't change it, at least surround the field name with square brackets.

Try

DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,[Time]) VALUES (" & Me.ID &
",
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"
 
Getting Syntax Error In INSERT INTO statemanet

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,Time) VALUES (" & Me.ID & ",
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

Any Thoughts?

Douglas J Steele said:
Date/Times need to be delimited with # characters (and need to be in
mm/dd/yyyy format, regardless of what your regional settings are). As well,
Time is a reserved word, and shouldn't really be used as a field name. If
you can't change it, at least surround the field name with square brackets.

Try

DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,[Time]) VALUES (" & Me.ID &
",
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Virtualdjs said:
Another Quick Question, OK This Works

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes) VALUES (" & Me.ID & ",
'Client Booked')"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

However, I also want to add the Date/Time to the Time Field, so I tried:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,Time) VALUES (" & Me.ID & ",
'Client Booked', " & Now() & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

Now I Get Run-Time error '3134'
Syntax error in Insert INTO Statement.

Any thoughts?
 
You don't appear to have put the square brackets around Time, as I said you
had to do.

Also, what data type is ClientId? If it's text, you'll need to put quotes
around Me.ID:

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,[Time]) VALUES ('" & Me.ID &
"',
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Virtualdjs said:
Getting Syntax Error In INSERT INTO statemanet

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,Time) VALUES (" & Me.ID & ",
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

Any Thoughts?

Douglas J Steele said:
Date/Times need to be delimited with # characters (and need to be in
mm/dd/yyyy format, regardless of what your regional settings are). As well,
Time is a reserved word, and shouldn't really be used as a field name. If
you can't change it, at least surround the field name with square brackets.

Try

DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,[Time]) VALUES (" & Me.ID &
",
'Client Booked', " & Format(Now(), "\#mm\/dd\/yyyy hh\:nn\:ss\#") & ")"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Virtualdjs said:
Another Quick Question, OK This Works

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes) VALUES (" & Me.ID & ",
'Client Booked')"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

However, I also want to add the Date/Time to the Time Field, so I tried:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Notes (ClientID,Notes,Time) VALUES (" &
Me.ID &
",
'Client Booked', " & Now() & ")"
DoCmd.SetWarnings True
Me.Notes_subform1.Requery

Now I Get Run-Time error '3134'
Syntax error in Insert INTO Statement.

Any thoughts?


:

Alright, I have a database of customers. I have a two tables:
Customers
&
Notes. The databases are related to as One to many (customers to
notes)
I
have no problems with this, on my CustomersForm, it displays the NotesSubform
no problem. Ok, now what I want to do is, hit an exsisting command button on
the CustomersForm, besides creating an email, I also want it to put
in a
note
that an email was sent.

So basically what I want to do is add a new note on the subform, for
instance "Email Inquiry Sent". by pressiong a command button on the
CustomersForm (Related to the client of course)

YOUR ASSISTANCE IS APPRECIATED
 
Back
Top