Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Module question. Run-Time error 2520

Status
Not open for further replies.

gbs01

MIS
Jun 2, 2003
73
US
Here is my code behind a command button:
------------------------------
Private Sub Command96_Click()

Dim X As Variant
X = InputBox("Please enter password to open this form:", "PASSWORD Prompt")
If X = "5491632" Then
DoCmd.OpenModule Module1.Appaoo
Else
MsgBox ("Sorry, you cannot update this database.")
End If

End Sub
------------------------------

It runs everything in the module fine & finishes updating my database,

but I get a run-time error 2520, "The action or method requires a Module or Procedure Name argument"

Thanks for your help!
jlig
 
Here is the code in my Module:
-----------------------------
Function Appaoo()
On Error GoTo Appaoo_Err
DoCmd.SetWarnings False

'Step 1) Delete old records in each table
'*****************************************
DoCmd.OpenQuery "qryDelRectblANI", acNormal, acEdit
DoCmd.OpenQuery "qryDelRectblCust", acNormal, acEdit
DoCmd.OpenQuery "qryDelRectblCUSTLOG", acNormal, acEdit
DoCmd.OpenQuery "qryDelRectblLOC_SERV", acNormal, acEdit
DoCmd.OpenQuery "qryDelRectblrecurr", acNormal, acEdit
DoCmd.OpenQuery "qryDelRectblTrouble", acNormal, acEdit

'Step 2) Append new records to empty tables from linked tables
'*****************************************
DoCmd.OpenQuery "qryApdAni", acNormal, acEdit
DoCmd.OpenQuery "qryApdcust", acNormal, acEdit
DoCmd.OpenQuery "qryApdcustlog", acNormal, acEdit
DoCmd.OpenQuery "qryApdloc_serv", acNormal, acEdit
DoCmd.OpenQuery "qryApdrecurr", acNormal, acEdit
DoCmd.OpenQuery "qryApdtrouble", acNormal, acEdit

' Since the tables are linked, no need to delete
'*****************************************
'DoCmd.RunSQL "DROP TABLE ani"
'DoCmd.RunSQL "DROP TABLE cust"
'DoCmd.RunSQL "DROP TABLE custlog"
'DoCmd.RunSQL "DROP TABLE loc_serv"
'DoCmd.RunSQL "DROP TABLE recurr"
'DoCmd.RunSQL "DROP TABLE trouble"


Beep
MsgBox "IMPORT COMPLETE ! All Files were updated correctly!", vbOKOnly, "FILES UPDATED INTO DATABASE"

DoCmd.SetWarnings True
Appaoo_Exit:
Exit Function

Appaoo_Err:
MsgBox Error$
Resume Appaoo_Exit

End Function
---------------------------------
 
And what about replacing this:
DoCmd.OpenModule Module1.Appaoo
By this ?
Call Appaoo

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV, You must live & breathe this forum. Thanks for the quick response. It did the trick.
Much gratitude,
jlig
 
One more question, on refreshing the data in my form.

Once my module finishes the update, all fields say #deleted# so I have to close the form & reopen.

I inserted this into the bottom of the code,
--------------------------
DoCmd.Close acForm, "frmSelectGradientFillDirection"
DoCmd.Open acForm, "frmSelectGradientFillDirection"
--------------------------
but it stops at the DoCmd.Open line.

Thanks again!
jlig
 
Why not simply Me.Requery or Me.Refresh ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top