vbMsgBoxResult Question

  • Thread starter Thread starter Sash
  • Start date Start date
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
 
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
..
 
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
..
 
Back
Top