|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Similar Wildcard problem
I have a similar wildcard problem that's on a earlier thread except I am trying to do a CreateParmsQuery so that when a user adds a new record to the database, a query is created using the name they type into the Textbox field which is bound to the database.
I already have the function CreateParmsQuery but I think my syntax is wrong. This is the function: Sub CreateParamsQuery(strDBPath As String, _ strSQL As String, _ strQryName As String) Dim catDB As ADOX.Catalog Dim cmd As ADODB.Command Set catDB = New ADOX.Catalog ' Open the Catalog object. catDB.ActiveConnection "Provider=Microsoft.Jet.OLEDB.4.0;"&_ "Data Source=" & strDBPath 'Create a Command object to contain the query's definition. Set cmd = New ADODB.Command cmd.CommandText = strSQL 'Add the query to the Procedures collection. catDB.Procedures.Append strQryName, cmd Set catDB = Nothing End Sub Here is my Query CreateParamsQuery "C:\Downloads\PSBDir10142002\database\db6.mdb", "Select Participants.Event, Participant.Full_Name,Participants From Participants WHERE (Participants.event = ''events1.text1.text'')" Events1 is the form Text1 is bound to the event field and is where the user types in the name of the event. THX |
|
#2
|
|||
|
|||
|
[/QUOTE]WHERE (Participants.event = ''events1.text1.text'')"[QUOTE]
should be WHERE (Participants.event = ''+events1.text1.text+'')" the rest seems fine but check this line (if it doesn't work try to heardcode the Participants.event for a test) |
|
#3
|
|||
|
|||
|
Works - kind of
It creates the query correctly but when I open it in Access of course it asks for the parameter since the query doesn't know what text1.text is.
That's OK. I really want it to run the query in the VB form. Can I use a similar fuction to run the query from the form ? Use this: Set cmd = New ADODB.Command cmd.CommandText = ??? instead of what is there now ? THX for all your help with this. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Similar Wildcard problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|