98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Using VBA to change a data type
Using VBA to change a data type
Resolved · Medium Priority · Version 2003
Charlotte has attended:
Access VBA course
Using VBA to change a data type
We receive large data files with field names 'memo' when they should be text or number - is there a way of changing this using VBA - currently we try changing it manually and get a memory error.
RE: Using VBA to change a data type
Hi Charlotte
Thank you for your question
You can convert memo filed data into string and integer values by using cstring and cint vb functions. The following code provides some examples
Set dbData = CurrentDb
Set rstEmployee = dbData.OpenRecordSet("Employees")
rstEmployee.MoveFirst
strAddress = rstEmployee.Fields("Address") 'This is a memo field
MsgBox CInt(strAddress)
MsgBox CInt(strAddress) * 30
MsgBox CStr(strAddress)
Hope this is useful
Regards
Stephen
Mon 18 May 2009: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:How To Find All Overdue Accounts?To find overdue accounts create a filter that compares today's date with the Invoice Date in the table. To do this: |