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

Problem with DoCmd.OpenForm

P: n/a
Hi,

I'm working with Acces2000 under W2000.

I'm using these sentences:

Dim Camp As Variant
Dim stDocName As String
Dim stCriteri As String

Camp = "3"
stDocName = "Form Reaccions"
stCriteri = "Reference = '" & Camp & "'
DoCmd.OpenForm stDocName, , , stCriteri

But when I execute the action, msaccess generate a window to input the
"Reference" valor.

I tried three ways:
1.- stCriteri = "Reference = '" & Camp & "'
2.- stCriteri = "Reference = " & Camp & "
3.- Const cQuote = """"
stCriteri = "Reference = " & cQuote & Camp & cQuote
But with all them I have the same result, the window demands me the
"Reference" valor. Can somebody help me?

Thanks, David.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Surround your form name with square brackets: [Form Reaccions] . In the
future, adopt a more conventional style of object naming that doesn't
include spaces ... for example frmReaccions.

Now ...

Is "Reference" a valid fieldname that is included in the recordsource of
[Form Reaccions]? Access will request a value if it doesn't find that field
in the recordsource

--
Scott McDaniel
CS Computer Software
Visual Basic - Access - Sql Server - ASP
"David" <da*****@grubit.net> wrote in message
news:fc**************************@posting.google.c om...
Hi,

I'm working with Acces2000 under W2000.

I'm using these sentences:

Dim Camp As Variant
Dim stDocName As String
Dim stCriteri As String

Camp = "3"
stDocName = "Form Reaccions"
stCriteri = "Reference = '" & Camp & "'
DoCmd.OpenForm stDocName, , , stCriteri

But when I execute the action, msaccess generate a window to input the
"Reference" valor.

I tried three ways:
1.- stCriteri = "Reference = '" & Camp & "'
2.- stCriteri = "Reference = " & Camp & "
3.- Const cQuote = """"
stCriteri = "Reference = " & cQuote & Camp & cQuote
But with all them I have the same result, the window demands me the
"Reference" valor. Can somebody help me?

Thanks, David.

Nov 12 '05 #2

P: n/a
I tried the addition to brackets, and occurs the same.

But don't worry, I have seen that the error has the origin in the form,
..., I want to open a form but the field belongs to a subform, that's
the problem.

I change the call and all works correctly now.

Thanks again.

David.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.