OpenForm WhereCondition

Will Cook
12-19-2003, 11:05 AM
The following worked for over a week, on many different forms, yesterday it just quit working in Access 2002:

Dim thisTestKey As Long
Dim strSql As String
strSql = "PowerAndCurrent.TestKey = " & thisTestKey
DoCmd.OpenForm FormName:="frmDetailPAC2575",
WhereCondition:=strSql, WindowMode:=acDialog
Whenever I execute the code now, I get queried for the value of TestKey.

The following code still works OK for opening a different form:

Dim strSql As String
strSql = "TestTime Between #" & myStartDate & "# and #" &
myEndDate & "#"
DoCmd.OpenForm FormName:="frmADCDACCheck",
WhereCondition:=strSql, WindowMode:=acDialog
The only differences I know of are:
1. thisTestKey is numeric, while myStartDate and myEndDate are dates.
2. TestKey is indexed while myStartDate and myEndDate are not.

Is there something special I need to do with integer values versus dates and text??? Did I somehow screw up a setting yesterday which would cause this?? Have I Mad Access 2002 disease?

Shurik12
12-19-2003, 01:09 PM
Hi
>yesterday it just quit working in Access 2002

You mean it used to work in Access 2002 and now not any more, or it never worked in Access 2000?

By "the only differences" you mean that you've changed data types/indexing in comparisson to when it worked or ...?


Regards,
Shurik.

Will Cook
12-19-2003, 01:35 PM
Hi
>yesterday it just quit working in Access 2002

You mean it used to work in Access 2002 and now not any more, or it never worked in Access 2000?

By "the only differences" you mean that you've changed data types/indexing in comparisson to when it worked or ...?


Regards,
Shurik.

Hi and Thanks for your reply.
This is strictly an Access 2002 application. I've been working on the application for a couple of weeks. Both sample pieces of code worked all this week up until yesterday morning when suddenly the first piece of code, the one with the TestKey column, just quit working. The two examples I used are two distinctly different pieces of code in two separate Subroutines. The only thing they have in common is that they are part of the same application. As another bizarre twist, about an hour ago I created a new little table and two new small forms and again inserted code exactly like the sample piece of code which no longer works, and the new code works fine while the previous code still does not. This is driving me nuts.

Shurik12
12-20-2003, 05:48 PM
What I suggest is that you'll do step-by-step execution (F8) and tell where exactly it debugs. Showing your code would be helpful too.
I think this is something minor that your are missing

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum