Create unique ID in VBScript

Kevin_S

Registered User.
Local time
Today, 03:21
Joined
Apr 3, 2002
Messages
635
Hi All - Need some help here as I've hit the proverbial wall on this one...

First - I know this is VBScript I'm look for help on in an Access Forum but I know some of you here work in multiple languages so I thought I'd post to see if someone can assist me.

Basically what I am trying to do is write a simple function in VBScript to be used in a custom form in ESRI ArcPad GIS (ArcPad's support language is VBScript). What I am trying to do is mimic some code I have in Access that uses the DMax function to return the highest vaule in a field in the associated table - add one to the number and append another controls value to the number - then save as the news record in the table. Here is the code I am trying to mimic in VBScript (in VBA):

Code:
Dim intGPS As Long
If IsNull(Me.UNITID) Then
Exit Sub
ElseIf IsNull(Me.GPS_ID) Then
        If MsgBox("Confirm Create New GPS Survey ID?", vbQuestion + vbYesNo, "COnfirm Add GPS ID") = vbYes Then
            intGPS = Nz(DMax("[GPS_ID]", "dbo_PARKINVT_INVENTORY", "[UNITID]=" & Me.UNITID) + 1, Me.UNITID & "0001")
            Me.GPS_ID = intGPS
        Else
            Exit Sub
        End If
Else
Exit Sub
End If

Can someone help me convert this to VBScript? At the very least can someone tell me the VBScript function that mimics the same function as DMax?

Thanks for any/all help on this!
Kev
 

Users who are viewing this thread

Back
Top Bottom