p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Access and Access VBA > Access
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 30th, 2006, 08:05 AM
Registered User
 
Join Date: Jan 2006
Location: Madrid, Madrid, Spain.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default User interaction...

Hi everyone,
New to this forum (and VBA ) - but amazed by the amount of information it contains.

One thing I do miss though is topics about user-friendly interfaces...
OK - I know, a world without users etc etc :D but still... What's the point of having a database if no one uses it???

To me, the most important is to find the data I've stored in my DB, and I'm struckling with something as simple as a string search - and it drives me crazy :(

I'm running Access 2003 on XP pro.
Having a plain table with usernames etc as source, a form where I can see the information and all I ask for is a routine, that gives me a window with a line where I can write a name (o part of it) and then the form returns with that specific record.

From my form I double-click on the field [Nombre] and I call following Sub:

Public Sub BuscaUsuario()

Dim Dbs As Database
Dim Rst As DAO.Recordset
Dim BuscaString As String
Dim BNombre1 As String

BuscaString = ""
BuscaString = InputBox("You are looking for...?")

Set Dbs = CurrentDb
BNombre1 = "[Nombre]=" &BuscaString
Set Rst = Me.RecordsetClone
Rst.MoveFirst
If Rst.NoMatch Then
   MsgBox "No match!"
Else
   Me.Bookmark = Rst.Bookmark
End if
Rst.FindFirst (BNombre1)
Mr.Requery

Rst.Close
Dbs.Close

End Sub

I'm using the InBox because that's the only "Pop-Up" function I know in VBA.
I've tried to enter the SQL directly in the Properties for the form, also with a string variable, and very elegant pops-up a window in order to enter a value in the variable - but I can't make it works with VBA
Instead of = I'd like to use LIKE as users rarely know the whole name and sir-name of the person they are looking for.

Anyone here who can say the magic syntax I'm missing? :D

Txs for a great place to find info...
Don Herman


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 30th, 2006, 05:50 PM
Friend of Wrox
Points: 3,645, Level: 25
Points: 3,645, Level: 25 Points: 3,645, Level: 25 Points: 3,645, Level: 25
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,114
Thanks: 2
Thanked 4 Times in 4 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

¡Bienvenidos a P2P, Don Herman!

Have you tried...?

BNombre1 = "[Nombre] = '" &BuscaString & "'"

Why? Because BuscaString is a string. They way you have it now, Access is expecting a number.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old January 31st, 2006, 12:06 AM
Friend of Wrox
Points: 597, Level: 8
Points: 597, Level: 8 Points: 597, Level: 8 Points: 597, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

¡ Y otro Bienvenidos!

To use LIKE:

BNombre1 = "((table.[Nombre]) LIKE " & "'" & BuscaString & "*'" & ")"

Access uses * as wildcard.

HTH,
Loralee


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old January 31st, 2006, 08:48 AM
Friend of Wrox
Points: 3,645, Level: 25
Points: 3,645, Level: 25 Points: 3,645, Level: 25 Points: 3,645, Level: 25
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,114
Thanks: 2
Thanked 4 Times in 4 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Oh, if you want to do a search within the string then might as well use the asterisks on BOTH sides...

BNombre1 = "[Nombre] Like '*" &BuscaString & "*'"


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel/Access interaction SarahDC Access VBA 0 September 24th, 2008 02:41 PM
.dll interaction with an application DavidStowell Visual Basic 2008 Essentials 2 March 3rd, 2008 04:33 PM
Calling javascript without user interaction bcahillane XSLT 1 November 3rd, 2006 12:24 PM
Reagrding the mouse interaction in C# CsharpHelp C# 5 May 19th, 2005 04:58 PM
INTERACTION anil_soma ADO.NET 2 September 23rd, 2004 02:58 AM



All times are GMT -4. The time now is 02:06 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc