Combine 3 text fields but I get a syntax error

SD23

Registered User.
Local time
Today, 11:02
Joined
Jun 13, 2006
Messages
60
I have three text boxes that are not linked to any tables. I want to combine the three text fields so that I can use this to search through a column in the table. The format I want is text1-text2 text3. I am not quite sure how to combine the three texts. I ahve tried

" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf

but i get a syntax error. I would aprreciate any help. Thank you
 
SD23 said:
I have three text boxes that are not linked to any tables. I want to combine the three text fields so that I can use this to search through a column in the table. The format I want is text1-text2 text3. I am not quite sure how to combine the three texts. I ahve tried

" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf

but i get a syntax error. I would aprreciate any help. Thank you

I'm assuming your putting the 3 values into one text box so you would want something like this:

Me.TextBoxName = Me.dpre & "-" & Me.dnum & " " & Me.dsuf

If any of these three could have the chance of being left blank then you should code for incase that happens, so you won't get Access errors.

HTH,
Shane
 
Thank you. The three values are in different text boxes, but I want to have them in that format so I can search through a column which has that format. SO if it finds something with the same format a msgbox will pop up. for example lets say we type in Red in the first text box, 66 in the second text box, and blue in the thirds text box. The code would put it in the format

red-66 blue

This would then search through the column in a table. How would I get it to search through a column in a table. I tried

Num = DLookup("" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf & "", "All Data Table", "" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf & "=[All Data Table].[Docket #]")

but it says syntax error in query expression. Any idea how I could get it to seach through a column. Thanks for your help
 
SD23 said:
Thank you. The three values are in different text boxes, but I want to have them in that format so I can search through a column which has that format. SO if it finds something with the same format a msgbox will pop up. for example lets say we type in Red in the first text box, 66 in the second text box, and blue in the thirds text box. The code would put it in the format

red-66 blue

This would then search through the column in a table. How would I get it to search through a column in a table. I tried

Num = DLookup("" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf & "", "All Data Table", "" & Me.dpre & "-" & Me.dnum & " " & Me.dsuf & "=[All Data Table].[Docket #]")

but it says syntax error in query expression. Any idea how I could get it to seach through a column. Thanks for your help

Hey SD23,

When you say, "search through the column in a table", do you mean one field in the table could have any of the three values or are there three separate fields in your table that have "red" in one field, "66" in another field and "blue" in another? Also, your DLookup does not have a field nor a table indentified so it's definately not going to work. You probably need to provide us with a little more details for us to help.

Shane
 

Users who are viewing this thread

Back
Top Bottom