access vba code
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Access vba code

Access vba code

resolvedResolved · Medium Priority · Version 2003

replyReplyFri 8 Jan 2010, 13:55Delegate David said...

Access vba code

Could someone explain howthe code below work. I can't understand various bits such as 'Open file for Binary', 'Get #1', 'Print #2' etc. Any help in deciphering this greatly appreciated


Sub output_sc4_file_east_west(mode, scenario)

'macro to read text file and create an SC4 text file
Dim FileContents As String

txt_filename = Left(CurrentDb.Name, Len(CurrentDb.Name) - 4) & "_" & scenario & ".txt"
sc4_filename = Left(CurrentDb.Name, Len(CurrentDb.Name) - 4) & "_" & scenario & "_" & mode & ".SC4"
airport = Left(CurrentProject.Name, 3)

'open txt file and read contents
Open txt_filename For Binary As #1
FileContents = Space(FileLen(txt_filename))
Get #1, , FileContents
Close #1

'remove quotation marks from txt file contents and define sc4 header info
sc4contents = Replace(FileContents, """", "")
sc4header = "ROUTEFILE," & airport & "_" & StrConv(mode, vbProperCase) & "_Routes.rta" & vbCrLf & "SPREADFILE,Departures_Spread.SPD" & vbCrLf & "PRDFILEDIRECTORY,N:\CAEP_NOx_Sample_Problem\INM_PRD_Files"

'create sc4 file
Open sc4_filename For Output As #2
Print #2, sc4header & vbCrLf & sc4contents
Close #2

'delete sc4 txt file
Kill txt_filename

End Sub

For upcoming training course dates see: Pricing & availability

replyReplyMon 11 Jan 2010, 14:50Trainer Stephen said...

RE: access vba code

Hi David

Thanks for the question

As discused, I will investigate and get back to you within the next few days

Regards

Stephen

Mon 18 Jan 2010: Automatically marked as resolved.

 

 

Please browse our web site to find out more about
microsoft database training and other Microsoft training courses.

Access tip:

Copy a Previous Record's Values to a New Record

If you often enter the same value in one field of a table, there are two methods to save re-typing the data.

1. Use Ctrl+' (apostrophe) to repeat the value input in the previous record.

2. Change the field's DefaultValue property in Design View to the most commonly used value.

View all Access hints and tips

forum postHow to save different version on the same word file?

» Forum post: MS Word


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training