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

Change default using VBA

Status
Not open for further replies.

35mph

Vendor
Aug 22, 2004
152
US
We have used VBA to lock the PO date in Transactions > Purchasing> Purchase Order Entry, so that the user can't change the PO date. It always defaults to the Toolbar date...

Now, if a user opens an OLD PO it (correctly) shows the OLD PO date... and that's what we want... and if they make a change and save it, that OLD PO date is saved along with the record as well... and that's what we want.

HOWEVER, when the new, blank PO screen is displayed, it continues to show that OLD PO date... not the date on the toolbar.

My understanding of VBA is a bit limited... so what would be the syntax if the window is still open... that is, it never closed.... we just changed and saved a record, and are starting to enter a new record... and want to make the date default back to the toolbar date?

Here's our existing VBA code:

Private Sub Window_AfterOpen()
Me.OldDate.Locked = True
End Sub

What I need is a clause that says:
If new record
set date back to toolbar date
End If

 
I would use the changed() event on the PO Number. Something like.

Sub PONumber_Changed()
If PONumber.Empty then
DocDate = Toolbar.UserDate
End If
End Sub

You will have the Toolbar added to VBA with the UserDate field added as well. This is hard for v8.00 as the toolbar is not visible. You need to import a Toolbar package created on a previous version to make this work. I can send you the package file if needed.

You could also use the line below to set to the system date.
DocDate = Date

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer
MBS Support - Asia Pacific

Microsoft Business Solutions

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top