I have a form that prints out some labels, after the printout I want the focus to get back to the form (on a specific field, Artikelnr). My code (on the button in the form) is
stDocName = "Etikett kundensartikelnr"
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.PrintOut , , , , i, False 'i = how many labels
DoCmd.Close acReport, stDocName
DoCmd.OpenForm "Etikettkundensartikelnummer"
1.Forms!etikettkundensartikelnummer.Artikelnr.SetFocus
2.Me.Artikelnr.SetFocus
in both tests I get an error message "Cant move the marking to Artikelnr" when I click the OK button it puts focus on the right field.
the code works but I get that annoying messagebox popping up everytime,
do you have any ideas how to get rid of the error message or is my code wrong?
Thankful for any suggestions
micke
stDocName = "Etikett kundensartikelnr"
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.PrintOut , , , , i, False 'i = how many labels
DoCmd.Close acReport, stDocName
DoCmd.OpenForm "Etikettkundensartikelnummer"
1.Forms!etikettkundensartikelnummer.Artikelnr.SetFocus
2.Me.Artikelnr.SetFocus
in both tests I get an error message "Cant move the marking to Artikelnr" when I click the OK button it puts focus on the right field.
the code works but I get that annoying messagebox popping up everytime,
do you have any ideas how to get rid of the error message or is my code wrong?
Thankful for any suggestions
micke