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

autonumber and continuos form

Status
Not open for further replies.

nadir66

IS-IT--Management
May 30, 2002
34
hi
i have a problem that keeps me going fo rthe last 2 days.
i have a continuos form, that i fill with data for manufacture formulas, and all the numbers need to be generated at that point. my problem is that this is a subform, so it does not get refreshed, and when i use dmax
=dmax("field", "table")+1 , the new(second) line is a duplicate. how can i solve this problem?
Thank you for your time.
 
not directly solving your problem, but look arount at this code, it might help solve yours.

Function MAXSEL()
MAXSEL = DMax("[SEL]", "tblACTIONS")
End Function
Function MAXJONRi()
MAXJONRi = DMax("[JO#]", "tblACTIONS", "LEFT([JO#],1)='I'")
End Function
Function MAXJONRp()
MAXJONRp = DMax("[JO#]", "tblACTIONS", "LEFT([JO#],1)='P'")
End Function


Private Sub Command49_Click()
DoCmd.DoMenuItem acFormBar, 5, 3, , 70
DoCmd.GoToRecord , , acNewRec
SendKeys "{TAB}", True

If Format(Frame56, "@") = "" Then
MsgBox "Please select joborder type", vbExclamation
DoCmd.GoToRecord , , acFirst
Exit Sub
ElseIf Frame56 = 1 Then
TJONR = Format(Mid(MAXJONRp, 2, 4) + 1, "0000")
[JO#] = "P" + TJONR + "-0000"
ElseIf Frame56 = 2 Then
TJONR = Format(Mid(MAXJONRi, 2, 4) + 1, "0000")
[JO#] = "I" + TJONR + "-0000"
End If

INCRSEL = MsgBox("Increase selection?", vbExclamation + vbYesNo)
If INCRSEL = vbYes Then
SEL = MAXSEL() + 1
Else
SEL = MAXSEL()
End If


Function MAXSEL()
MAXSEL = DMax("[SEL]", "tblACTIONS")
End Function
Function MAXJONRi()
MAXJONRi = DMax("[JO#]", "tblACTIONS", "LEFT([JO#],1)='I'")
End Function
Function MAXJONRp()
MAXJONRp = DMax("[JO#]", "tblACTIONS", "LEFT([JO#],1)='P'")
End Function




Good luck,
Kuzz

"Time spent debating the impossible subtracts from the time during which you
can try to accomplish it."
 
Thanx
the solution gave me some ideas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top