Hi,
I have the following code to check for duplicate number. the code work when
there is an existing number. I got error when IDStg is null.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim Stg As String
Dim IDStg As String
IDStg = ""
IDStg = DLookup("Ck_ContractID", "msgDuplicateContract", "[Ck_ContractID]='"
& Me.Ck_ContractID & "'")
If Len(IDStg) > 1 Then
Stg = "Agreement Number: " & IDStg & " has been assigned to " & vbCr &
vbLf & DLookup("Location", "msgDuplicateContract", "[Ck_ContractID]='" &
Me.Ck_ContractID & "'") & vbCr & vbLf & "by " & DLookup("Owner",
"msgDuplicateContract", "[Ck_ContractID]='" & Me.Ck_ContractID & "'")
MsgBox Stg, vbOKOnly + vbInformation, "Found Duplicate FOG"
Me.Ck_ContractID.SetFocus
End If
End With
SF
Mike Painter - 22 May 2008 05:35 GMT
Can you have a single digit IDStg ?
If not you can use the Nz function
If Nz(IdStg,"") <>"" then..
You could use If Not Nz(IdStg,"") then
but that can get fuzzy at 3:00 Am unless you use it a lot.
> IDStg = ""
> IDStg = DLookup("Ck_ContractID", "msgDuplicateContract",
[quoted text clipped - 12 lines]
>
> SF
SF - 22 May 2008 10:54 GMT
It works fine.
Thank.
> Can you have a single digit IDStg ?
> If not you can use the Nz function
[quoted text clipped - 20 lines]
>>
>> SF