473,545 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need WorkAround: The expression you entered refers to an object that is closed or doesn't exist.

I understand why I am getting this error, I just need to find a work
around for it. Here is what I'm trying to do: There is a textbox on
my form that OnClick will ask the user for a new value, I want to take
this value and update the textbox with this value. I can't use the
recordsource option on this textbox because the Form ControlSource is
constantly changing. Here is the code I'm using:

Dim MyResponse As String
Dim MyNewVal As Currency
Dim Salary As Currency

MyResponse = InputBox("Enter a value of 1 or 2" & Chr(13) & "1) Enter
New Hourly Wage" & Chr(13) & "2) Enter a Salary", "New Rate")
Select Case MyResponse
Case "1"
MyResponse = InputBox("Input your Hourly Rate", "New Rate")
If MyResponse <> "" Then
MyNewVal = MyResponse
lblRate.Control Source = "=" & MyNewVal
lblRate.Default Value = MyNewVal
lblRate.Requery
End If
Case "2"
MyResponse = InputBox("Input a Salary", "Salary to Hourly")
If MyResponse <> "" Then
Salary = MyResponse
MyNewVal = CalcSalary(Sala ry)
lblRate.Control Source = "=" & MyNewVal
lblRate.Default Value = MyNewVal
lblRate.Requery
End If
End Select
If MyResponse <> "" Then
Call cmdCalc_Click
End If

This code works but it does not save the new value. It will work while
the form is in Normal View, but if I go to design mode or close it all
together the next time I open the form it reverts back to the original
value I typed in the Design Mode for this textbox. I need to come up
with a work around to have this textbox updateable with a value that
will be saved in the form and shows up the next time I open this form.

May 10 '06 #1
1 3203
ja************* @gmail.com wrote in
news:11******** **************@ u72g2000cwu.goo glegroups.com:
I understand why I am getting this error, I just need to find
a work around for it. Here is what I'm trying to do: There
is a textbox on my form that OnClick will ask the user for a
new value, I want to take this value and update the textbox
with this value. I can't use the recordsource option on this
textbox because the Form ControlSource is constantly changing.
Here is the code I'm using:

Dim MyResponse As String
Dim MyNewVal As Currency
Dim Salary As Currency

MyResponse = InputBox("Enter a value of 1 or 2" & Chr(13) &
"1) Enter New Hourly Wage" & Chr(13) & "2) Enter a Salary",
"New Rate") Select Case MyResponse
Case "1"
MyResponse = InputBox("Input your Hourly Rate", "New
Rate") If MyResponse <> "" Then
MyNewVal = MyResponse
lblRate.Control Source = "=" & MyNewVal
lblRate.Default Value = MyNewVal
lblRate.Requery
End If
Case "2"
MyResponse = InputBox("Input a Salary", "Salary to
Hourly") If MyResponse <> "" Then
Salary = MyResponse
MyNewVal = CalcSalary(Sala ry)
lblRate.Control Source = "=" & MyNewVal
lblRate.Default Value = MyNewVal
lblRate.Requery
End If
End Select
If MyResponse <> "" Then
Call cmdCalc_Click
End If

This code works but it does not save the new value. It will
work while the form is in Normal View, but if I go to design
mode or close it all together the next time I open the form it
reverts back to the original value I typed in the Design Mode
for this textbox. I need to come up with a work around to
have this textbox updateable with a value that will be saved
in the form and shows up the next time I open this form.

create a table. In the OnOpen event of your form dLookUp() the
value from this table. in the code which processes your user
inputs, update the value to this table.


--
Bob Quintal

PA is y I've altered my email address.
May 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
19535
by: CLarkou | last post by:
On a client's machine with Office 97, my access program gives an error "The Expression you entered refers to an object that is closed or doesn't exist" when I am assigning a value in the checkbox. chk_multiuser.Value = 0 What could be the cause of this error ?
14
2056
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
10
2824
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone know a solution for this? Thanks!
21
2374
by: Steven T. Hatton | last post by:
I'm trying to improve my formal understanding of C++. One significant part of that effort involves clarifying my understanding of the vocabulary used to describe the language. This is from the C++ Standard: "" "...sequence of operators and operands that specifies a computation...". That means to me that an expression can be...
1
2044
by: sumit205 | last post by:
Error 2467:The Expression you entered refers to an object that is closed or doesn't exist . DoCmd.OpenForm frm2, WindowMode:=acDialog, OpenArgs:="c" & NewProductID In the debig mode when i place my cursor on the OpenArgs it displaye the error "the Expression you entered refers to an object that is closed or doesn't exist ." what could be...
15
2154
by: Jess | last post by:
Hello, Sometimes declarations are all what we need when we define/declare classes (or functions?), but sometimes we need definitions. I learned that if we define a class (B) that has an object (a_obj) of a class type (A), then we need to define A as well, but if B has a pointer to A, then we only need to forward declare A. I was told this...
6
6577
by: weston | last post by:
In Access 2000 I have a form with a tab control with 3 tabs. I have a button that is supposed to check if each question on the form has been completed. The code that is under this button is below. It works for the questions on the first 2 tabs but when it gets to the questions on the 3rd tab I get the following error message "The expression you...
7
1660
by: sdanda | last post by:
I am working on windows applications(VB.net). I created a form with a textbox and one button. I would like to test the value entered in the textbox after this textbox loses the focus. The value entered in this textbox is some file path. I would like to check whether this path exists or not. But I did this in button click event. But I want to do...
0
1792
by: akshaycjoshi | last post by:
I am reading a book which says Even though unboxed value types don't have a type object pointer, you can still call virtual methods (such as Equals, GetHashCode, or ToString) inherited or overridden by the type. The reason is because the CLR can just call these methods nonvirtually and System.ValueType overrides all of these virtual methods...
0
7464
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7396
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7413
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7751
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1874
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
700
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.