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!

SendTo Conditional command??????

Status
Not open for further replies.

KrissyB

Technical User
May 2, 2003
27
CA
In the following VBA code, where I am using the SendObject Command how can I get it to only SendObject if within the Publisher Data tale, the field supplier is say equal to 1234? I know this is a simple question but I am relatively new to this but really want to learn!

Thanks in advance for any help!

Function MacroModuleQueryTest()
On Error GoTo MacroModuleQueryTest_Err

DoCmd.OpenQuery "QUERY_CLEARPOATEST", acNormal, acEdit
DoCmd.OpenQuery "QUERY_APPENDCHP_LOAD_POA_STATUS", acNormal, acEdit
DoCmd.OpenQuery "QUERY_APPENDCHP_POA_STATUS", acNormal, acEdit
DoCmd.OpenQuery "QUERY_INVALTUPC", acNormal, acEdit
DoCmd.OpenQuery "QUERY_APPENDINGTOPUBLISHERDATA", acNormal, acEdit
DoCmd.SendObject acTable, "Publisher Data", "MicrosoftExcel(*.xls)", "cbotham@indigo.ca", "", "", "", "", False, ""


MacroModuleQueryTest_Exit:
Exit Function

MacroModuleQueryTest_Err:
MsgBox Error$
Resume MacroModuleQueryTest_Exit

End Function
 
Create a new Query based on the "Publisher Data" Table, call it say "qryPublisherData", set the Field "Supplier" Criteria to wahatever you want, say Forms!YourFormName!YourControlName. Replace your existing DoCmd.SendObject with:

DoCmd.SendObject acQuery, "qryPublisherData", "MicrosoftExcel(*.xls)", "cbotham@indigo.ca", "", "", "", "",


Good Luck

Bill
 
Thanks you Bill for your suggestion. I should have explained that I am trying to generate this conidtion because I have many many Supplier that could possible be dealt with. I was hoping to use an If, Else if format, but was unsure if I could do this with a DoCmd.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top