Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Help with code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SF - 22 May 2008 02:54 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.