How to Convert or Cast in MS Access
Various versions of the widely used MS SQL database program use the CAST or CONVERT functions to change data stored as numbers into text format. This function can be very useful, especially when creating custom queries and reports. While Microsoft Access does not use the CAST and CONVERT language, it does provide users with the same functionality. Users of Access databases can build queries that convert the data in their tables into the format of their choice.
Instructions
-
-
1
Open Microsoft Access and go to the database you want to work with. Open the table that contains the field whose data you want to convert.
-
2
Note the field name you want to convert. Close the table and go to the "Queries" section.
-
-
3
Choose "New" and "Design View" to create a new query. Double-click the table that contains the field you want to convert, then click "Close Table."
-
4
Double-click the fields you want to include in your query. Move the cursor to the empty field to the right of the last field you selected for the query.
-
5
Type "NewField: CInt(FieldName)" where NewField is the name you want to give your converted data and FieldName is the name of the field you want to convert. For instance, if you want to create a converted field named Converted and populate it with the data from the Price field, you would type "Converted: CInt(Price)."
-
6
Click "Save" and type a name for your query. Click the "Run" button to see the results of your query. The "Run" button is the one that looks like an exclamation point.
-
1
- Photo Credit Burke/Triolo Productions/Brand X Pictures/Getty Images