-
select command
Hi
I am trying to use the input from any of three text boxes
(last name, first name or ID) to
select and match records from a access2k database-----I am not sucessful.
Any help?
here is the code for the search
regards
cal
SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
frmSearch.txtLastName.Text & "' "
SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
frmSearch.txtFirstName.Text & "'"
SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
frmSearch.txtID.Text & "';"
-
Re: select command
In Access LIKE statement uses *
SELECT * FROM TABLE_NAME WHERE NAME LIKE '*SOME_NAME*'
T H
"cal" <sticks2@earthlink.net> wrote:
>
> Hi
> I am trying to use the input from any of three text boxes
>(last name, first name or ID) to
> select and match records from a access2k database-----I am not sucessful.
>Any help?
>
>here is the code for the search
>
>regards
>cal
>
>
>SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
> frmSearch.txtLastName.Text & "' "
>
>SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
> frmSearch.txtFirstName.Text & "'"
>
>SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
> frmSearch.txtID.Text & "';"
-
Re: select command
I used the like statement---see the code below=--==-==I was thinking about
a case statement
and then select the correct case----has anyone done that
"T H" <tonnyh@medianetworks.net> wrote:
>
>In Access LIKE statement uses *
>
>SELECT * FROM TABLE_NAME WHERE NAME LIKE '*SOME_NAME*'
>
>T H
>
>"cal" <sticks2@earthlink.net> wrote:
>>
>> Hi
>> I am trying to use the input from any of three text boxes
>>(last name, first name or ID) to
>> select and match records from a access2k database-----I am not
sucessful.
>>Any help?
>>
>>here is the code for the search
>>
>>regards
>>cal
>>
>>
>>SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
>> frmSearch.txtLastName.Text & "' "
>>
>>SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
>> frmSearch.txtFirstName.Text & "'"
>>
>>SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
>> frmSearch.txtID.Text & "';"
>
-
Re: select command
Hi Cal,
Do you get an error or dont you get any results? If you have a form where
any of the 3 fields could be filled in and you use "LIKE", because you want
to get all contacts beginning with the input, you could try this, (I assume
ID Number is an integer):
SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
frmSearch.txtLastName.Text & "%' OR [First / Middle Initial] LIKE
'" & _
frmSearch.txtFirstName.Text & "%' OR [ID Number] = " & _
CInt(frmSearch.txtID.Text)
regards,
Kristina
"cal" <sticks2@earthlink.net> wrote:
>
> Hi
> I am trying to use the input from any of three text boxes
>(last name, first name or ID) to
> select and match records from a access2k database-----I am not sucessful.
>Any help?
>
>here is the code for the search
>
>regards
>cal
>
>
>SQL = "SELECT * FROM Contact WHERE [Last Name] LIKE '" & _
> frmSearch.txtLastName.Text & "' "
>
>SQL = "SELECT * FROM Contact WHERE [First / Middle Initial] LIKE '" & _
> frmSearch.txtFirstName.Text & "'"
>
>SQL = "SELECT * FROM Contact WHERE [ID Number] LIKE '" & _
> frmSearch.txtID.Text & "';"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks