473,385 Members | 1,782 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,385 software developers and data experts.

parameter query passed from a form with wildcards

MVM
Hi everyone,
I am working on an Access project (ADP). I have a switchboard form setup to
allow the user to open up another form by entering search criteria in a text
box and clicking a command button. Then the form opens using input
parameters and grabbing the data in the switchboard text box. My question
is this, how do I grab the data from the switchboard form and put a wildcard
on both ends of the data when passed to the input parameters?

On the form that opens I have the recordset set to:
SELECT FixedAssets.*, Departments.Department FROM FixedAssets INNER JOIN
Departments ON FixedAssets.Dept = Departments.Dept_Num WHERE
FixedAssets.Description = ?

On the same form I have the Input Parameters set to:
FixedAssets.Description nvarchar LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

With this code it prompts me to input data when the form opens instead of
grabbing it from the Switchboard form. If I take off the wildcards I need
to have the exact description before it will find a record.

Thanks!
MVM
Nov 12 '05 #1
4 10325
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form's recordsource, you want to "grab" the data in the
"switchboard" form's TextBox, should look like this:

SELECT FixedAssets.*, Departments.Department
FROM FixedAssets INNER JOIN Departments ON FixedAssets.Dept =
Departments.Dept_Num
WHERE FixedAssets.Description LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5Sn2YechKqOuFEgEQJ6TACfVB+SSjxouayzgxSZkxtlb5 xs+twAn0Yv
XBCJUkDJclvAFINg3o6m8DRy
=djus
-----END PGP SIGNATURE-----

MVM wrote:
Hi everyone,
I am working on an Access project (ADP). I have a switchboard form setup to
allow the user to open up another form by entering search criteria in a text
box and clicking a command button. Then the form opens using input
parameters and grabbing the data in the switchboard text box. My question
is this, how do I grab the data from the switchboard form and put a wildcard
on both ends of the data when passed to the input parameters?

On the form that opens I have the recordset set to:
SELECT FixedAssets.*, Departments.Department FROM FixedAssets INNER JOIN
Departments ON FixedAssets.Dept = Departments.Dept_Num WHERE
FixedAssets.Description = ?

On the same form I have the Input Parameters set to:
FixedAssets.Description nvarchar LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

With this code it prompts me to input data when the form opens instead of
grabbing it from the Switchboard form. If I take off the wildcards I need
to have the exact description before it will find a record.

Thanks!
MVM


Nov 12 '05 #2
MVM
Thanks for the help. I tried this statement and I get an invalid SQL
statement error.
Any other ideas?
"MGFoster" <me@privacy.com> wrote in message
news:sJ*****************@newsread4.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form's recordsource, you want to "grab" the data in the
"switchboard" form's TextBox, should look like this:

SELECT FixedAssets.*, Departments.Department
FROM FixedAssets INNER JOIN Departments ON FixedAssets.Dept =
Departments.Dept_Num
WHERE FixedAssets.Description LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5Sn2YechKqOuFEgEQJ6TACfVB+SSjxouayzgxSZkxtlb5 xs+twAn0Yv
XBCJUkDJclvAFINg3o6m8DRy
=djus
-----END PGP SIGNATURE-----

MVM wrote:
Hi everyone,
I am working on an Access project (ADP). I have a switchboard form setup to allow the user to open up another form by entering search criteria in a text box and clicking a command button. Then the form opens using input
parameters and grabbing the data in the switchboard text box. My question is this, how do I grab the data from the switchboard form and put a wildcard on both ends of the data when passed to the input parameters?

On the form that opens I have the recordset set to:
SELECT FixedAssets.*, Departments.Department FROM FixedAssets INNER JOIN
Departments ON FixedAssets.Dept = Departments.Dept_Num WHERE
FixedAssets.Description = ?

On the same form I have the Input Parameters set to:
FixedAssets.Description nvarchar LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

With this code it prompts me to input data when the form opens instead of grabbing it from the Switchboard form. If I take off the wildcards I need to have the exact description before it will find a record.

Thanks!
MVM

Nov 12 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doh... That's because I forgot you're working in an .adp project.
You'll have to set up the SQL statement in VBA & then put it into the
RecordSource. Something like the following in the form that's
opening:

Private Sub Form_Open(Cancel As Integer)

Dim strSQL As String

strSQL = "SELECT FixedAssets.*, Departments.Department " & _
"FROM FixedAssets INNER JOIN Departments " & _
"ON FixedAssets.Dept = Departments.Dept_Num " & _
"WHERE FixedAssets.Description LIKE '*" & _
Forms![Switchboard]![txtDescription] & "*'"

Me.RecordSource = strSQL

End Sub

Note the single-quotes in the WHERE clause. This should produce a
clause like this:

WHERE FixedAssets.Description Like '*television*'

if the Forms![Switchboard]![txtDescription] contains the word
"television."

The above assumes that you have the tables FixedAssets and Departments
linked to the project (look in the Tables tab of the database window).

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5WKT4echKqOuFEgEQKQmQCeJup/yTeqdaoKvEekZ6koqGKtNscAn2Yh
3da/Al51QkM3cJ05Fw2COijc
=3xYv
-----END PGP SIGNATURE-----

MVM wrote:
Thanks for the help. I tried this statement and I get an invalid SQL
statement error.
Any other ideas?
"MGFoster" <me@privacy.com> wrote in message
news:sJ*****************@newsread4.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form's recordsource, you want to "grab" the data in the
"switchboard" form's TextBox, should look like this:

SELECT FixedAssets.*, Departments.Department
FROM FixedAssets INNER JOIN Departments ON FixedAssets.Dept =
Departments.Dept_Num
WHERE FixedAssets.Description LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5Sn2YechKqOuFEgEQJ6TACfVB+SSjxouayzgxSZkxtlb5 xs+twAn0Yv
XBCJUkDJclvAFINg3o6m8DRy
=djus
-----END PGP SIGNATURE-----

MVM wrote:
Hi everyone,
I am working on an Access project (ADP). I have a switchboard form
setup to
allow the user to open up another form by entering search criteria in a
text
box and clicking a command button. Then the form opens using input
parameters and grabbing the data in the switchboard text box. My
question
is this, how do I grab the data from the switchboard form and put a
wildcard
on both ends of the data when passed to the input parameters?

On the form that opens I have the recordset set to:
SELECT FixedAssets.*, Departments.Department FROM FixedAssets INNER JOIN
Departments ON FixedAssets.Dept = Departments.Dept_Num WHERE
FixedAssets.Description = ?

On the same form I have the Input Parameters set to:
FixedAssets.Description nvarchar LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

With this code it prompts me to input data when the form opens instead
of
grabbing it from the Switchboard form. If I take off the wildcards I
need
to have the exact description before it will find a record.

Thanks!
MVM



Nov 12 '05 #4
MVM
Woohoo! That worked. Thanks!
"MGFoster" <me@privacy.com> wrote in message
news:gT***************@newsread4.news.pas.earthlin k.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doh... That's because I forgot you're working in an .adp project.
You'll have to set up the SQL statement in VBA & then put it into the
RecordSource. Something like the following in the form that's
opening:

Private Sub Form_Open(Cancel As Integer)

Dim strSQL As String

strSQL = "SELECT FixedAssets.*, Departments.Department " & _
"FROM FixedAssets INNER JOIN Departments " & _
"ON FixedAssets.Dept = Departments.Dept_Num " & _
"WHERE FixedAssets.Description LIKE '*" & _
Forms![Switchboard]![txtDescription] & "*'"

Me.RecordSource = strSQL

End Sub

Note the single-quotes in the WHERE clause. This should produce a
clause like this:

WHERE FixedAssets.Description Like '*television*'

if the Forms![Switchboard]![txtDescription] contains the word
"television."

The above assumes that you have the tables FixedAssets and Departments
linked to the project (look in the Tables tab of the database window).

HTH,

MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5WKT4echKqOuFEgEQKQmQCeJup/yTeqdaoKvEekZ6koqGKtNscAn2Yh
3da/Al51QkM3cJ05Fw2COijc
=3xYv
-----END PGP SIGNATURE-----

MVM wrote:
Thanks for the help. I tried this statement and I get an invalid SQL
statement error.
Any other ideas?
"MGFoster" <me@privacy.com> wrote in message
news:sJ*****************@newsread4.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form's recordsource, you want to "grab" the data in the
"switchboard" form's TextBox, should look like this:

SELECT FixedAssets.*, Departments.Department
FROM FixedAssets INNER JOIN Departments ON FixedAssets.Dept =
Departments.Dept_Num
WHERE FixedAssets.Description LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

- --
MGFoster:::mgf
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP5Sn2YechKqOuFEgEQJ6TACfVB+SSjxouayzgxSZkxtlb5 xs+twAn0Yv
XBCJUkDJclvAFINg3o6m8DRy
=djus
-----END PGP SIGNATURE-----

MVM wrote:

Hi everyone,
I am working on an Access project (ADP). I have a switchboard form


setup to
allow the user to open up another form by entering search criteria in a


text
box and clicking a command button. Then the form opens using input
parameters and grabbing the data in the switchboard text box. My


question
is this, how do I grab the data from the switchboard form and put a


wildcard
on both ends of the data when passed to the input parameters?

On the form that opens I have the recordset set to:
SELECT FixedAssets.*, Departments.Department FROM FixedAssets INNER JOINDepartments ON FixedAssets.Dept = Departments.Dept_Num WHERE
FixedAssets.Description = ?

On the same form I have the Input Parameters set to:
FixedAssets.Description nvarchar LIKE "*" &
Forms![Switchboard]![txtDescription] & "*"

With this code it prompts me to input data when the form opens instead


of
grabbing it from the Switchboard form. If I take off the wildcards I


need
to have the exact description before it will find a record.

Thanks!
MVM


Nov 12 '05 #5

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

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
3
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and...
3
by: dnl | last post by:
I have a parameter query that I would like to simplify so that I wouldn't need to use wildcards when entering in partial data. The following line is in the criteria field when designing the query:...
6
by: wylie72 | last post by:
I'm trying to create a adodb recordset in an Access Module for updating but when I try to open it it returns EOF. However, I can cut and past the sql into QueryBuilder it returns the record. At a...
4
by: andylcx | last post by:
Hi all: I have one question about the system call under Unix system. I would like to copy all the files in the current directory to a destination directory using the following code, but it does...
3
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening...
3
by: george.lengel | last post by:
Hello experts, I have been struggling for days to solve this problem and every suggestion I find via Google does not work for me. There is probably a solution out there that will do what I want,...
4
beacon
by: beacon | last post by:
I have a report that is pulling data from a query. The query gets sent a parameter from a form. The information on the form is correct, but my summary section is incorrect. The reason the summary...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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
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...
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...

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.