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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert Suppression 1

Status
Not open for further replies.

jewilson2

Technical User
Feb 7, 2002
71
US
I have a piece of VB code within an Access Database that imports a csv file, runs a make table query against the imported table, renames both tables, then exports the data to a fixed length text file. During the make table query, Access gives the standard "you are about to paste xxx records.......". Is there a line in the code that I could add to suppress this alert?
I'll paste the code, but it's gonna be tough to read because the Do.Sql command is soooooo long.
Thanks

Function Macro1()
On Error GoTo Macro1_Err

DoCmd.TransferText acImportDelim, "Metlife Dental Import Specification", "Metlifein", "\\lfh_homer\department\benefits\LawsonInterface\metlife.csv", False, ""
DoCmd.RunSQL "SELECT Metlifein.[Transaction Code], Metlifein.[Customer Number], Metlifein.[Employee SSN], Metlifein.Filler, Metlifein.[Member SSN], Metlifein.[Member Last Name], Metlifein.[Member First Name], Metlifein.[Member Middle Initial], Metlifein.[Member Birthdate], Metlifein.[Member Marital Status], Metlifein.[Member Sex], Metlifein.[Relationship Code], Metlifein.[Employees Employment Date], Metlifein.[Personnel ID], Metlifein.Filler2, Metlifein.[Survivor Indicator], Metlifein.[Survivor SSN], Metlifein.[Survivor Last Name], Metlifein.[Survivor First Name], Metlifein.[Foreign Address Indicator], Metlifein.[Street Address], Metlifein.[Address Line 2], Metlifein.City, Metlifein.State, Metlifein.Zip, Metlifein.[Type Coverage], Metlifein.[Coverage Start Date], Metlifein.[Coverage Stop Date], Metlifein.[Group Number], Metlifein.Subdivision, Metlifein.Branch, Metlifein.[Plan Code], Metlifein.[Status Code], Metlifein.[Members Covered Code], Metlifein.[COBRA Indicator] INTO metlife " & _
"FROM Metlifein WHERE (((Metlifein.Include)='Y'));"
DoCmd.TransferText acExportFixed, "Metlife Export Specification", "Metlife", "\\lfh_homer\department\benefits\LawsonInterface\metlifeout.txt", False, ""
DoCmd.Rename "Metlife_" & Format$(Date, "mmddyy") & Format$(Time, ":hhnn"), acTable, "Metlife"
DoCmd.Rename "Metlifein_" & Format$(Date, "mmddyy") & Format$(Time, ":hhnn"), acTable, "Metlifein"

If Err.Number = 0 Then
MsgBox ("Metlife Formatting Complete. File written to \\lfh_homer\department\benefits\LawsonInterface\metlifeout.txt ")
End If

Macro1_Exit:
Exit Function

Macro1_Err:
MsgBox Error$
Resume Macro1_Exit

End Function
 
add the setwarnings property.

docmd.setwarnings false

your code

docmd.setwarnings true
 
Warning: Be sure to have an error handler that turns warnings back on in case an error is encountered. Else you'll not see much in the way of messages until something happens to turn them back on again.
Signed,
Sad voice of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top