I'm new to VB and attempting something (seemingly very very basic by normal standards) and I can not seem to get my Where expression to read values from my inputbox. This is what i have and i am recieving an error sayings "The Microsoft Jet Database engine does not recognize 'x' as a valid field name or expression"
Dim x As Integer
Dim y As Integer
strFirstvalue = InputBox("Enter Starting Value", "Starting Value", "0")
strSecondvalue = InputBox("Enter Ending Value", "Ending Value", "100")
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReport "MTBF", acViewPreview, , "[Serial Number] Between x and y", acWindowNormal, " "
any simple fixes?
5 1511
I'm new to VB and attempting something (seemingly very very basic by normal standards) and I can not seem to get my Where expression to read values from my inputbox. This is what i have and i am recieving an error sayings "The Microsoft Jet Database engine does not recognize 'x' as a valid field name or expression"
Dim x As Integer
Dim y As Integer
strFirstvalue = InputBox("Enter Starting Value", "Starting Value", "0")
strSecondvalue = InputBox("Enter Ending Value", "Ending Value", "100")
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReport "MTBF", acViewPreview, , "[Serial Number] Between x and y", acWindowNormal, " "
any simple fixes?
Greetings, believeinblue44!
It looks like you need to also dimension strFirstvalue and strSecondvalue, I would say as String. Give that a go, see what you have...
try this -
Dim x As Integer
-
Dim y As Integer
-
-
x = InputBox("Enter Starting Value", "Starting Value", 0)
-
y = InputBox("Enter Ending Value", "Ending Value", 100)
Sorry for a slow response but i just returned from a short trip to Mexico and finally catching back up with other tasks. But...I'm still recieving an error stating
"Run-Time Error 3070"
"The Microsoft Jet Database Engine does not recognize 'x' as a valid field name or expression".
Perhaps with it linking to access, access does not read variables as values but rather i need to put x,y into a table of it's own?
Assume x=1 and y=10 "[Serial Number] Between x and y"
would be equivalant to: [Serial Number] Between x and y "[Serial Number] Between 'x' and 'y'"
would be equivalant to: [Serial Number] Between 'x' and 'y' "[Serial Number] Between '" & x & "' and '" & y & "'"
would be equivalant to: [Serial Number] Between '1' and '10' "[Serial Number] Between " & x & " and " & y
would be equivalant to: [Serial Number] Between 1 and 10
Thank you, that removed my 3070 error. Now i'm recieving errors on my report but...i think that may be related to the filter itself.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: news.microsoft.com |
last post by:
hey all, I am having an odd problem with the InputBox in VB.NET, and it ONLY
happens on one of my computers. When I try "Dim x as String =
InputBox("TESTPROMPT"), I get the following error:
...
|
by: matthewemiclea |
last post by:
I have a form command with the following code in it:
Dim Worder As Variant
Dim rcrd As Variant
_____________________________________
Worder = InputBox("Work Order ID", "Info for pulled order")...
|
by: missimaths |
last post by:
I was wondering if anyone knew of a way to control the text a user
types into an inputbox? I want the user to type in four letters only. I
can check the lenght by using the len() function in vba...
|
by: Hans Kamp |
last post by:
How do I use InputBox?
private void addButton_Click(object sender, System.EventArgs e)
{
string newName;
newName = InputBox("t1", "t2", "t3");
namesListBox.Items.Add(newName);
}
|
by: portroe |
last post by:
How can you populate an array using an inputbox(es)?
thanks
portroe
|
by: james.ii.turner |
last post by:
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...
|
by: jpoquette |
last post by:
I have recently upgraded a Visual Basic 2003 win forms application to
2005. After doing so I can no longer get my project to compile. The
code is bombing on any line that uses an InputBox. I'm...
|
by: believeinblue44 |
last post by:
I'm new to VB and attempting something (seemingly very very basic by normal standards) and I can not seem to get my Where expression to read values from my inputbox. This is what i have and i am...
|
by: altesse33 |
last post by:
I am trying to open the form "frmClients_Main" to the record that is specified by the end user. Here is the code:
----------------------------------------------------------
Public Function...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |