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

Form Code Problem 1

Status
Not open for further replies.

JohnTcolo

MIS
Aug 28, 2002
216
US
I am trying to create a form that does the following on a new record:

Increment Field Value by 1
Repeat Date Field
Repeat Text Field

I can do the first 2 fine, but when I add the code for the text repeat, it stops working. Can someone look at the code below and tell me what I am doing wrong? Thanks in advance.

======================================================
Option Compare Database

Private Sub Tktdate_BeforeUpdate(Cancel As Integer)

Private Sub Tktnum_Enter()
intMax = DLookup("Max(tktnum)", "ticket detail")
intMax = intMax + 1
Me.Tktnum = intMax

End Sub

Private Sub Tktdate_AfterUpdate()
Me.Tktdate.DefaultValue = "#" & Me.Tktdate.Value & "#"
End Sub



Private Sub Form_Current()

Me.Product.DefaultValue = DLast("Product", "Ticket Detail")

End Sub


 
Try a

msgbox DLast("Product", "Ticket Detail")


and see what this brings back. Use MsgBox is debugging your code.

rollie@bwsys.net
 
Thanks for your help, I placed the line in the beforeupdate section and it returns the proper value. I get #Name? in the field on a new record if I use my original code line there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top