473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with DoCmd.OpenForm

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
2 1884
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DD | last post by:
I want to link a form to another form by a Cmd Button. CustomerID = CustomerID I want the form to open from the Cmd Button as if it was acting in the same way as subform What would be the code?...
3
by: Michael Hanlon | last post by:
listed below is the code i have written that is not working any help would be great if you can show me where i went wrong as i am new to this side. thanks in advance. Private Sub...
3
by: Lyn | last post by:
Hi, I have a Search input form which collects from the user a person's name. I am using LIKE with a "%" suffix in the SQL so that the user does not have to type in the full name. When they hit...
9
by: martin | last post by:
please help I have a table with member details and another one to many table used for payments. The problem is that the foreign key is not saved into the payment table causing the table to not...
15
by: Thelma Lubkin | last post by:
formA determines some_where and some_value and issues docmd.close ,Me docmd.openform "formB", , ,some_where, , ,some_value formB receives the correct some_where and some_value After...
2
by: Mike | last post by:
I am trying to open a search results form based on the input from a prompt form. I am using the following code: --- Begin Code --- Private Sub btnSearch_Click() 'Dim Variable and assign data...
12
by: insomniux | last post by:
Hi, In my database (access 2000) everything is done within the main form ("OpenForm"). It has a timer which triggers the code below. It first closes all reports and forms. Then it reopens the main...
4
by: erick-flores | last post by:
Hello I am using an If statement to test if a field = IsNull then close that form and open another one. Here is the code: Private Sub Form_Load() If IsNull(Me.loc_fk) Then MsgBox "This...
11
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my...
2
by: mark mestrom | last post by:
hi, i have this problem with OpenForm and the stLinkCriteria. I have the following code: Private Sub Knop22_Click() On Error GoTo Err_Knop22_Click Dim stDocName As String Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.