473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Where expression not reading Inputbox?

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?
Jun 15 '07 #1
5 1511
Dököll
2,364 Expert 2GB
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...
Jun 16 '07 #2
debasisdas
8,127 Expert 4TB
try this


Expand|Select|Wrap|Line Numbers
  1. Dim x As Integer
  2. Dim y As Integer
  3.  
  4. x = InputBox("Enter Starting Value", "Starting Value", 0)
  5. y = InputBox("Enter Ending Value", "Ending Value", 100)
Jun 16 '07 #3
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?
Jun 26 '07 #4
danp129
323 Expert 256MB
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
Jun 26 '07 #5
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.
Jun 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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: ...
3
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")...
2
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...
1
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); }
7
by: portroe | last post by:
How can you populate an array using an inputbox(es)? thanks portroe
1
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...
8
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...
11
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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,...
0
jinu1996
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...
0
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...
0
isladogs
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...

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.