I want to combine two fields in an access database, I was trying this VB code:
But it's not working it will show.....Code:Field1_Field2: [Field1]&"-"&[Field2]
Compile Error:
Expected:Expression
and is highlighting the "&" after [Field1]
I want to combine two fields in an access database, I was trying this VB code:
But it's not working it will show.....Code:Field1_Field2: [Field1]&"-"&[Field2]
Compile Error:
Expected:Expression
and is highlighting the "&" after [Field1]
What result did you get?
Compile Error:
Expected:Expression
and is highlighting the "&" after [Field1]
Are these fields from the same table?
Yes. They are both on the same table.
Can you post the SQL?
I'm not sure what you are asking me to post?
Sorry. When in query design, select "View > SQL View". copy the text of the query, and post it.
ah, learn something new every day!
SELECT Sheet1.Field1, Sheet1.Field2
Field1_Field2: [Field1]&"-"&[Field2]
FROM Sheet1;
Try this:
Code:SELECT [Field1] & "-" & [Field2] AS Field1_Field2 FROM Sheet1;
That worked perfectly! Thanks! My next ? is, how could I then convert this data to a table, so I could place it on my form?
First, save the query.
Then select the query as the "record source" for your form.
What if I need to add, data from my original table to this new table. I.E. add data from table1 to the new CombinedField1_Field2 form?
Is [table1] the same as [Sheet1]?
Yes, table1 and sheet1 are the same. Sorry I should have stuck with the same naming convention.