If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
write sql using a form
I have several fields that I need to concatenate together based on user
selection in a form. For example, if the user selects Field1 then Field2, I need a query with SELECT [Table1]![Field1] & [Table1]![Field2]. If the user selects Field2 then Field1, I need a query with SELECT [Table1]![Field2] & [Table1]![Field1] Any help is appreciated. |
#2
|
|||
|
|||
Hi,
Start with an empty string (zero character) , then add the "fields" as they are selected (gotFocus): If SelectionInProgress Then myString= myString & "FieldName" & ", " End If with SelectionInProgress a form-variable, Boolean, that you set to true when your selection process is active. At the end, remove the ending ", " and complete the SQL statement: mySQL = "SELECT " & Left(myString, len(myString)-2) & " FROM tableName" Hoping it may help, Vanderghast, Access MVP "Randal" rlwnrAThighstream.net wrote in message ... I have several fields that I need to concatenate together based on user selection in a form. For example, if the user selects Field1 then Field2, I need a query with SELECT [Table1]![Field1] & [Table1]![Field2]. If the user selects Field2 then Field1, I need a query with SELECT [Table1]![Field2] & [Table1]![Field1] Any help is appreciated. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Strange stLinkCriteria behaviour on command button | Anthony Dowd | Using Forms | 3 | August 21st, 2004 03:01 AM |
Write Conflict Message when using a Form | Danny | Using Forms | 1 | July 24th, 2004 11:38 PM |
Function isn't available in expressions in query expression | Reiner Harmgardt | General Discussion | 4 | July 21st, 2004 09:30 AM |
Display Parameter from Form on Report | sara | Setting Up & Running Reports | 10 | July 19th, 2004 04:54 PM |
Passing value to modal child form in MS Access using VBA? | Grahammer | Using Forms | 6 | July 4th, 2004 11:53 PM |