sparklegrrl
Registered User.
- Local time
- Today, 06:38
- Joined
- Jul 10, 2003
- Messages
- 124
My new db up and running but I have a couple of issues that have come up as well as a new report I am trying to program. I was wondering if anyone can help. The db was built in Access 2000 on a Win2000 machine. Three of the machines here are running XP with Access 2003. I asked one of these in another area of the forum but never got it resolved.
1) I have a form that merges and prints with word using the following event procedure:
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("f:\Company\DatabaseFiles\GATXINSPECTIONFORMS.doc")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("PurchaseOrder").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
.ActiveDocument.Bookmarks("CarInitials").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("CarInitial2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("PurchaseOrder2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
.ActiveDocument.Bookmarks("Thickness").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Thickness.Column(1)))
.ActiveDocument.Bookmarks("Rubber").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Inventory))
.ActiveDocument.Bookmarks("Vendor").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Vendor))
.ActiveDocument.Bookmarks("Pipe").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Pipe.Column(1)))
.ActiveDocument.Bookmarks("LiningDate").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXliningdate))
.ActiveDocument.Bookmarks("Employee1").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
.ActiveDocument.Bookmarks("Title").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Title))
.ActiveDocument.Bookmarks("CarInitial3").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber3").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("CarInitial4").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber4").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("Employee2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
.ActiveDocument.Bookmarks("CarInitial5").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber5").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
End With
'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False
'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
Exit Sub
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
Exit Sub
End If
End Sub
This works GREAT on my pc and one other however, on the other 2 pcs (xp/2003), it simply opens word and nothing happens.
2) On the two new pc's you get a security warning when opening the database due to the macros I believe. Is there anyway to get rid of it?
3) I have a report that calculates the total company portion of 401K in an unbound textbox as follows: =IIf([FidelityPercentage]=0,0,[Text70]*0.03). This is Text117. I can't seem to get it to total at the bottom of the report. When I put an unbound box there that says =sum([Text117]) and I open the report it asks me the start date, end date and then asks me for Text117. Aarggh..I can't figure this one out.
And last but not least....
4) Our employee time is tracked on a daily basis for job costing purposes but on a weekly basis for payroll. For example. John Doe may work 14 hours in one day which is recorded as a cost for that job as 8 hours regular pay and 6 hours overtime, however, if he misses the next day at work and only has 32 regular hours and 14 overtime hours he would be paid for 40 regular and 6 overtime.
BUT, if there is a holiday or vacation time then he does in fact get the 32 regular, 14 overtime and 8 vacation which i paid at the regular rate.
Right now I have the report totalling the regular and overtime and splitting it as necessary.
For example...to calculate regular pay:
=IIf([Text91]>40,40,[Text91])
And for Overtime:
=IIf([Text91]-40<0,0,[Text97])
This works GREAT...BUT, I need it to look for the total vacation (text29) and holiday (text31) and if they are greater than 0 then it equals (text19), if they are less than zero then I need it to use the above calculation.
I have no clue how to write that expression.
I tried in several forms....
=IIf([Text29]or[Text31]>0,[Text19], [Text91]>40,40,[Text91])
5) I created a custom menu for the db. How do I open a form in add mode from the menubar?
Can anyone help? THANKS!
1) I have a form that merges and prints with word using the following event procedure:
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("f:\Company\DatabaseFiles\GATXINSPECTIONFORMS.doc")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("PurchaseOrder").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
.ActiveDocument.Bookmarks("CarInitials").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("CarInitial2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("PurchaseOrder2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!PurchaseOrderID))
.ActiveDocument.Bookmarks("Thickness").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Thickness.Column(1)))
.ActiveDocument.Bookmarks("Rubber").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Inventory))
.ActiveDocument.Bookmarks("Vendor").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!Vendor))
.ActiveDocument.Bookmarks("Pipe").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Pipe.Column(1)))
.ActiveDocument.Bookmarks("LiningDate").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXliningdate))
.ActiveDocument.Bookmarks("Employee1").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
.ActiveDocument.Bookmarks("Title").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!Title))
.ActiveDocument.Bookmarks("CarInitial3").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber3").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("CarInitial4").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber4").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
.ActiveDocument.Bookmarks("Employee2").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!GATXINSPECTIONFORMsub!GATXInspector.Column(3)))
.ActiveDocument.Bookmarks("CarInitial5").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarInitials))
.ActiveDocument.Bookmarks("CarNumber5").Select
.Selection.Text = (CStr(Forms!GATXINSPECTIONFORMMAINform!CarNumberID))
End With
'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False
'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
Exit Sub
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
Exit Sub
End If
End Sub
This works GREAT on my pc and one other however, on the other 2 pcs (xp/2003), it simply opens word and nothing happens.
2) On the two new pc's you get a security warning when opening the database due to the macros I believe. Is there anyway to get rid of it?
3) I have a report that calculates the total company portion of 401K in an unbound textbox as follows: =IIf([FidelityPercentage]=0,0,[Text70]*0.03). This is Text117. I can't seem to get it to total at the bottom of the report. When I put an unbound box there that says =sum([Text117]) and I open the report it asks me the start date, end date and then asks me for Text117. Aarggh..I can't figure this one out.
And last but not least....
4) Our employee time is tracked on a daily basis for job costing purposes but on a weekly basis for payroll. For example. John Doe may work 14 hours in one day which is recorded as a cost for that job as 8 hours regular pay and 6 hours overtime, however, if he misses the next day at work and only has 32 regular hours and 14 overtime hours he would be paid for 40 regular and 6 overtime.
BUT, if there is a holiday or vacation time then he does in fact get the 32 regular, 14 overtime and 8 vacation which i paid at the regular rate.
Right now I have the report totalling the regular and overtime and splitting it as necessary.
For example...to calculate regular pay:
=IIf([Text91]>40,40,[Text91])
And for Overtime:
=IIf([Text91]-40<0,0,[Text97])
This works GREAT...BUT, I need it to look for the total vacation (text29) and holiday (text31) and if they are greater than 0 then it equals (text19), if they are less than zero then I need it to use the above calculation.
I have no clue how to write that expression.
I tried in several forms....
=IIf([Text29]or[Text31]>0,[Text19], [Text91]>40,40,[Text91])
5) I created a custom menu for the db. How do I open a form in add mode from the menubar?
Can anyone help? THANKS!