Good day,
I have a form (CSearch) to input data and search for records in a query and displays it on a subform (CAff) once a search button is clicked.
I have a current event on the subform that check if the field "CONTRACTSTATUS" is "Expired" and if so gives a message box saying "This contract is expired"
This works when the main form has been loaded already, but whenever I re-open the form I get error 2424 "The expression you entered..."
Can you help me? Here is the code I'm using: - Private Sub Form_Current()
-
If Me.NewRecord Then
-
Me!CONTRACTSTATUS.Visible = True
-
End If
-
If Me.CONTRACTSTATUS.Value = "EXPIRED" Then
-
MsgBox ("This contract is expired")
-
Else
-
Me!CONTRACTSTATUS.Visible = False
-
Exit Sub
-
End If
-
End Sub
Thank you.
I expect that means that the subform is using a recordset that is non-updatable. In such a case, when the main form has not yet been used to specify the search, there are no records in the subform at all. As it's not updatable there is not even any possibility of it being at the New Record position. From here Me.CONTRACTSTATUS.Value has no meaning as there is no current record from which it can take context.
In short, your code needs first to check if there is a current record before it tries to refer to it.
I hope that helps, and I'm a little confused that, in such a scenario, it would even trigger the Current event. Check out that idea anyway and see what you find.
3 1403 NeoPa 32,556
Expert Mod 16PB
Please could you include the full error message and the number of the line of code wher it occurs.
Run-time error '2424':
"The expression you entered has a field, control, or property name that toolbox can't find"
And when I click on Debug, line # 5 is highlighted.
NeoPa 32,556
Expert Mod 16PB
Thank you.
I expect that means that the subform is using a recordset that is non-updatable. In such a case, when the main form has not yet been used to specify the search, there are no records in the subform at all. As it's not updatable there is not even any possibility of it being at the New Record position. From here Me.CONTRACTSTATUS.Value has no meaning as there is no current record from which it can take context.
In short, your code needs first to check if there is a current record before it tries to refer to it.
I hope that helps, and I'm a little confused that, in such a scenario, it would even trigger the Current event. Check out that idea anyway and see what you find.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: cbielins |
last post by:
I would like to alter a table's column from null to not null. Is this
possible or can you only do the reverse?
If I can do it, what's the syntax, the .pdf doesn't describe it.
TIA,
Chris
|
by: Jacky11 |
last post by:
Can anyone help me?
Please see the code I'm using now.
Public Function sheetlayout()
On Error GoTo Err_Command1_Click
Dim xl As Object
Set xl = GetObject("c:\windows\desktop\123.csv")...
|
by: Miguelito Bain |
last post by:
hi everybody-
i have a form with 2 fields on it that i want the user to fill out
before he or she can save the record, close the record, or move to the
next record, etc...
here's the code i...
|
by: Lance |
last post by:
Is there a "best" technique for hiding a form's Close ControlBox button (i.e., the button with an "X" in the top-right corner of a form) but still show the minimize and maximize buttons? I've found...
|
by: Tony |
last post by:
Hi,
I wonder why when I do a filter by form, some text fields show all the
data in the table in the combo box and others only show two items, Is
Null and Not Is Null. I want to show all data,...
|
by: Jiho Han |
last post by:
Here's the issue.
You have a class,
Class Person
{
public int id;
public string firstname;
public string lastname;
}
|
by: Alex |
last post by:
Hello all,
I have a main form(say "form1") .i want to display another form(say
"form2") on occuring of an event (say a button click) and want to hide
it after some time so that it will again...
|
by: mars123 |
last post by:
hi,
I am facing a js error in my code, below is the prob. statement
I have a radio2 javascript function as below, it works like this..
When a parent radio button is selected only one of its...
|
by: Lucrecious |
last post by:
How do I create a dynamic report based on a query that updates from a select field form? I followed the information from the article here entitled: "Checkbox form to allow user to select query output...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |