vbMsgBoxResult Question

S

Sash

I'm trying to allow the user to load another file by using the following
code, but I get type miss match on the first line.

Do While VbMsgBoxResult = vbYes
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Import File"
.Filters.Add "Text", "*.txt"
.Filters.Add "All Files", "*.*"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = "\c:InputFiles/"
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
End If
End With

'Trim File Header
Call TrimFileHeaderX(fileName, 1)

'Load with Specs
stSpecs = "ABCCompany"
sttable = "tblABC"
stfilename = fileName
DoCmd.SetWarnings False
DoCmd.TransferText acImportDelim, stSpecs, sttable, stfilename
DoCmd.SetWarnings True

'Ask Another Import if so, GOTO GetFile and loop until user says NO
VbMsgBoxResult = MsgBox("Load Another File?", vbYesNo)
Loop
 
J

John Spencer

Try declaring your variables

Dim vbMsgBoxResult as Long
vbMsgBoxResult = vbYes

Do While vbMsgBoxResult = vbYes
.....

Loop

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
S

Sash

PERFECT!!!


John Spencer said:
Try declaring your variables

Dim vbMsgBoxResult as Long
vbMsgBoxResult = vbYes

Do While vbMsgBoxResult = vbYes
.....

Loop

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top