Hi Sandy.
Use an Update query to break field into two and populate the new HouseNumber
column.
Before you do this, though, how do do you decide where the house number
ends? Is it the first space? What about entries such as:
- 74B Field St
- Unit 4, 32 Somme St
- Lot 64 ...
- Care/Of Someone Else ...
It really is notoriously difficult to handle addresses of all forms,
especially if your database includes addresses in multiple countries. That's
why many of us leave the number and street in the same field, even though a
good argument can be made for separating the number and street type into
different fields.
Assuming you treat the first space as the end of the number part (so 74B is
the "number" in the first example above), try this:
1. Create a query into this table.
2. Change it to an Update query: Update on Query menu.
Access adds an Update row to the grid.
3. In the Update row under your HouseNumber column, enter:
Left([Address], Instr([Address], " ")-1)
4. Run the Update query to populate the number.
5. In the Update row under the Address field, enter:
Mid([Address], Instr([Address], " ")+1)
6. Run the Update query to chop the number off the beginning of the adress.
7. Manually correct the entries where this process got it wrong.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Sandy said:
Hello:
I have a database where someone included the house number in the same field with the street name.
Is there a way I can put the house number in a separate column?
Any help will be greatly appreciated!
Sandy