Hi perennial,
Waht is this function supposed to do???
There is no need to execute a Select query.
Dave :-)
Main Topics
Browse All TopicsMaybe I am just looking at this too long...
I would like to refresh the database after the function is run. I put the Refresh at the end of my function and here is the error that I received:
Compile error:
Sub for Function not defined
Without the refresh the module work fine.
Here is my module:
Function PrintStickingLabel()
Dim i As Integer
Dim db As Database, tdf As TableDef
Set db = CurrentDb
i = MsgBox("You are about to print sticking label; do you want to continue?", vbYesNo, "Import Cutting")
If i = vbNo Then
Exit Function
Else
DoCmd.SetWarnings False
'''''Check if table "tblStickingLabelProppck" exist, if does then delete
For Each tdf In db.TableDefs
If tdf.Name = "tblStickingLabel" Then
DoCmd.DeleteObject acTable, tdf.Name
End If
Next tdf
'''Creating table for printing sticking label
CurrentDb.Execute " SELECT Master.ItemCode, tblHarvestingSchedule.PNam
& " tblHarvestingSchedule.Prin
& " Master.Location, Sum(Master.Qty) AS TotalQty, Master.CDate, AllClockNo([ItemCode],[Sow
& " [SowSize],[EventType],[Loc
& " tblHarvestingSchedule.StkQ
& " FROM Master INNER JOIN tblHarvestingSchedule ON Master.ItemCode = tblHarvestingSchedule.Item
& " GROUP BY Master.ItemCode, tblHarvestingSchedule.PNam
& " tblHarvestingSchedule.Prin
& " Master.EventType, Master.Location, Master.CDate, " _
& " AllClockNo([ItemCode],[Sow
& " tblHarvestingSchedule.Note
& " HAVING (((tblHarvestingSchedule.P
& " ((tblHarvestingSchedule.No
End If
Refresh >>>this is where I like it to be.
End Function
Thanks
perennial
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mgh_mgharishPosted on 2005-07-19 at 13:45:59ID: 14479373
Hi perennial,
Try CurrentDb.Refresh
Bye
---
Harish