A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Will not open Dialog box



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2006, 05:16 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box

This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub
  #2  
Old November 20th, 2006, 05:56 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Will not open Dialog box

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and Access 97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub



  #3  
Old November 20th, 2006, 06:10 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box

no just whats here. I did not see the "Excel" in that part of the code. Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and Access 97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub




  #4  
Old November 20th, 2006, 06:18 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Will not open Dialog box

Copy all of the code in the shaded box (between Code Start and Code End)
into a new module, and save it with a unique name (say, mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news
no just whats here. I did not see the "Excel" in that part of the code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub






  #5  
Old November 20th, 2006, 06:50 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box

Doug,
I have not used this API before, I just set the path name. With this Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next lines
stating “only comments can appear”…… These will be Excel files only. I just
don’t know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code End)
into a new module, and save it with a unique name (say, mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news
no just whats here. I did not see the "Excel" in that part of the code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub






  #6  
Old November 20th, 2006, 06:52 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box

Doug,
I have not used this API before, I just set the path name. With this Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next lines
stating “only comments can appear”…… These will be Excel files only. I just
don’t know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code End)
into a new module, and save it with a unique name (say, mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news
no just whats here. I did not see the "Excel" in that part of the code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub






  #7  
Old November 20th, 2006, 07:15 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Will not open Dialog box

It sounds as though you might have copied too much (only copy what's in the
shaded area), or else you didn't copy it into a new module. Make sure it's
an actual module, as opposed to a Class Module.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
Doug,
I have not used this API before, I just set the path name. With this Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next lines
stating "only comments can appear".. These will be Excel files only. I
just
don't know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code End)
into a new module, and save it with a unique name (say, mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news
no just whats here. I did not see the "Excel" in that part of the code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and
Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub








  #8  
Old November 20th, 2006, 09:11 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box


Doug,
I have been using the Get External Data (Excel spreadsheet) then converting
it to a table, then run the Find Duplicates Query. The code you told me to
copy does work, but does not bring up the file for me to convert to a table.
I am like DOEY!




"Douglas J. Steele" wrote:

It sounds as though you might have copied too much (only copy what's in the
shaded area), or else you didn't copy it into a new module. Make sure it's
an actual module, as opposed to a Class Module.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
Doug,
I have not used this API before, I just set the path name. With this Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next lines
stating "only comments can appear".. These will be Excel files only. I
just
don't know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code End)
into a new module, and save it with a unique name (say, mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news no just whats here. I did not see the "Excel" in that part of the code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and
Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub









  #9  
Old November 20th, 2006, 10:43 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Will not open Dialog box

I have no idea what you mean by "bring up the file for me to convert to a
table". All that code does is return the full path to the file. You have to
take that full path and do something with it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"tmaxwell" wrote in message
...

Doug,
I have been using the Get External Data (Excel spreadsheet) then
converting
it to a table, then run the Find Duplicates Query. The code you told me to
copy does work, but does not bring up the file for me to convert to a
table.
I am like DOEY!




"Douglas J. Steele" wrote:

It sounds as though you might have copied too much (only copy what's in
the
shaded area), or else you didn't copy it into a new module. Make sure
it's
an actual module, as opposed to a Class Module.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
Doug,
I have not used this API before, I just set the path name. With this
Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next
lines
stating "only comments can appear".. These will be Excel files only. I
just
don't know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code
End)
into a new module, and save it with a unique name (say,
mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news no just whats here. I did not see the "Excel" in that part of the
code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and
Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on
strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub











  #10  
Old November 21st, 2006, 02:15 PM posted to microsoft.public.access.forms
tmaxwell
external usenet poster
 
Posts: 33
Default Will not open Dialog box

Doug,
Once I got it to return the full path, it allows me to pick the file, once
I do, nothing happens. I just not sure I am going about this the right way.
As I stated, I was using the create new table, and on the file menu I was
using the "Get External Data" choosing the Excell file, then converting the
Excel file to a table. Then I ran the New query "Find duplicate records" Qry.
I need to put this on a from page for the users to be able to do on there
own.

"Douglas J. Steele" wrote:

I have no idea what you mean by "bring up the file for me to convert to a
table". All that code does is return the full path to the file. You have to
take that full path and do something with it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"tmaxwell" wrote in message
...

Doug,
I have been using the Get External Data (Excel spreadsheet) then
converting
it to a table, then run the Find Duplicates Query. The code you told me to
copy does work, but does not bring up the file for me to convert to a
table.
I am like DOEY!




"Douglas J. Steele" wrote:

It sounds as though you might have copied too much (only copy what's in
the
shaded area), or else you didn't copy it into a new module. Make sure
it's
an actual module, as opposed to a Class Module.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
Doug,
I have not used this API before, I just set the path name. With this
Db, I
have a Form, and I want the users to be able to click and have the Open
Dialog Box to prompt them for file location.
I copied the complete code, but I get an error right after this next
lines
stating "only comments can appear".. These will be Excel files only. I
just
don't know what I am doing wrong.

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long


"Douglas J. Steele" wrote:

Copy all of the code in the shaded box (between Code Start and Code
End)
into a new module, and save it with a unique name (say,
mdlCommonDialog).

Then your code will work.

Unless you copy that code, it will not work.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
news no just whats here. I did not see the "Excel" in that part of the
code.
Can I
just list the Excel call?

"Douglas J. Steele" wrote:

Did you copy all of the code from
http://www.mvps.org/access/api/api0001.htm?

I can attest for the fact that it works fine in Access 2003 (and
Access
97)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tmaxwell" wrote in message
...
This should call the "Open Dialog Box". it errors out on
strFilter=
ahtAddFilterItem
I am using 2003 access. I am use to working with access 97?

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub












 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.