Access 97 SQL string won't open unbound form

I am converting a 2.0 appliction to 97.  The rowsource is not being set from the DoCmd statement, see below
cremickAsked:
Who is Participating?
 
Victor SpiridonovCommented:
The way you are setting it will not work in Access'97. What you can do is to put your SQL in form OpenArgs property and  put the following code in form's On Load event:
ME.recordsource=me.OpenArgs

0
 
cremickAuthor Commented:
Edited text of question
0
 
tomookCommented:
If I understand correctly what you are saying, this should be no problem. Can you give us an example? Note that in Access97, the default value for the RecordSource property is "" (empty string) rather than Null. If you are checking for Null, this may be your problem.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ramromconsultant Commented:
It should work just fine. We need more details. Exactly what does not work; what is the evidence?

Forms per se are not bound or unbound; "bound" applies to controls.
0
 
cremickAuthor Commented:
I'm upgrading the PrimeVest Access 2.0 app to 97.  One technique I used
often was to open an unbound form with a SQL string -
DoCmd OpenForm "frmTransactions", , strSQL

But, when I converted to 97, this didn't work.  The rowsource was not
getting set to the SQL string.  I got around the problem by setting the
rowsource of the form to a query and changing the DoCmd statement to use a
filter rather than a SQL statement, but I don't know why SQL didn't work.
Any ideas?
0
 
tomookCommented:
I am surprised this worked in Access 2. The argument you are using is essentially for a filter. I assume Access 2 did not check, appended the string to the recordsource, and voila: there was a complete recordsource. MS probably saw this as a bug and "fixed" it for you.
0
 
TrygveCommented:
You could do the following;

DoCmd.OpenForm "frmTransactions"
forms![frmTransactions].recordsource = strSQL
forms![frmTransactions].requery ' Don't know if this line is necessary.
0
 
TrygveCommented:
From the developer CD;


Using Recordset Locking

You use exclusive mode to lock an entire database. You use recordset locking, on the other hand, to control how one or more individual tables in a database are locked. Recordset locking applies only to table- and dynaset-type Recordset objects; it doesn't apply to snapshot- and forward-only-type Recordset objects because these are inherently read-only objects.

Note   The default recordset lock is a write lock, which means that other users can't edit data in the locked records. You can also prevent users from reading the data by setting a read lock. You may want to do this if you are making bulk changes to a Recordset object and you want to prevent users from reading the data until you have completed your update. To set a read lock, specify the dbDenyRead constant in the options argument of the OpenRecordset method. For more information, search the Help index for "OpenRecordset method."
0
 
TrygveCommented:
Sorry about that. The comment on Record Locking is abviously posted to the wrong question
0
 
cremickAuthor Commented:
Edited text of question
0
 
cremickAuthor Commented:
Edited text of question
0
 
cremickAuthor Commented:
I will give spiridonov's a try and then give it a grade.  Thanks 6/27/1998
0
 
TrygveCommented:
Did you try my first posting (the one that was not to the wrong question) ?

DoCmd.OpenForm "frmTransactions"
forms![frmTransactions].recordsource = strSQL
forms![frmTransactions].requery ' Don't know if this line is necessary.
0
 
cremickAuthor Commented:
I still don't understand why in the Access 97 help it says this code will work and it doesn't.  When converting the code from 2.o to 97 the code will not work with out your workaround but in a newly created 97 access mdb it works.
0
 
TrygveCommented:
Without remembering the text from the original question I seem to remember that I have read an artivle about converting 2->97 where forms based no queries with some spesific words in it could be casued to not work correctly after the conversion. I could not find the article when I looked for it today.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.