By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Single Quote in DoCmd ?

JAMBAI
P: 28
Hi,

Is there a way to handle single quotes when inserting the records using the below do command. Or do I need to write Insert sql.

DoCmd.GoToRecord , , acNewRec

Thanks
Jambai
Feb 21 '07 #1
Share this Question
Share on Google+
8 Replies


Rabbit
Expert Mod 10K+
P: 12,366
I'm not quite sure what you're talking about but you can get single quotes by using:
Expand|Select|Wrap|Line Numbers
  1. "'"
Feb 21 '07 #2

JAMBAI
P: 28
I'm not quite sure what you're talking about but you can get single quotes by using:
Expand|Select|Wrap|Line Numbers
  1. "'"

This will helpful for me only when I insert the records using insert sql statement.

Here I am trying to insert the records using DoCmd.Forms fields are bound to the table.

Thanks
Feb 21 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
What DoCmd function are you trying to use to insert records?
Feb 21 '07 #4

JAMBAI
P: 28
What DoCmd function are you trying to use to insert records?

DoCmd.GoToRecord , , acNewRec

Thanks
Feb 21 '07 #5

Rabbit
Expert Mod 10K+
P: 12,366
DoCmd.GoToRecord , , acNewRec

Thanks
This will take you to a new record, it doesn't insert a new record. A new record is inserted only once you have begun to enter information and it is updated to the table. Whatever you type into the text boxes is what will be stored.
Feb 21 '07 #6

JAMBAI
P: 28
This will take you to a new record, it doesn't insert a new record. A new record is inserted only once you have begun to enter information and it is updated to the table. Whatever you type into the text boxes is what will be stored.
The below code was created from the button wizard.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command34_Click()
  2. On Error GoTo Err_Command34_Click
  3.     DoCmd.GoToRecord , , acNewRec
  4. Exit_Command34_Click:
  5.     Exit Sub
  6. Err_Command34_Click:
  7.     MsgBox Err.Description
  8.     Resume Exit_Command34_Click
  9. End Sub
I need to check for existing record before the record is inserted into the table, I am solved the problem with single quote check,

Thanks
Jambai
Feb 21 '07 #7

Rabbit
Expert Mod 10K+
P: 12,366
How do you determine if a record exists? Is there a primary key?
Feb 21 '07 #8

MMcCarthy
Expert Mod 10K+
P: 14,534
The below code was created from the button wizard.

Private Sub Command34_Click()
On Error GoTo Err_Command34_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command34_Click:
Exit Sub
Err_Command34_Click:
MsgBox Err.Description
Resume Exit_Command34_Click
End Sub
All this code does is to move the form to the add new record postition. You must have clicked on the wrong option in the wizard.

I need to check for existing record before the record is inserted into the table, I am solved the problem with single quote check,
Sorry Jambai you will have to explain this better as it doesn't make sense to us.

Mary
Feb 22 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.