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.

Month and Year Validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jody - 19 May 2008 16:43 GMT
Hi,

Since a full date is not recorded, my form has a MonthID field (Number
datatype) and a YearID field (also Number datatype).  Both receive values via
a combo list.

I would like to have the form validate that the month and year combination
that are selected do not already exist in the underlying table.

Is there a DCount or DLookup statement or something else that can validate
both field values by checking the existing records to see if the combination
already exists within a record in the underlying table?

Any help would be greatly appreciated.

Thanks,
Jody
Arvin Meyer [MVP] - 19 May 2008 16:58 GMT
Try this example, substituting your own field and table names:

DLookUp("[Rate]","[tblRates]","[ID] = " & Form![ID] & " And [CompanyID] = "
& Form![CompanyID])

The above will only work if ID and CompanyID are numeric. If, for example,
ID were text, then you would need to add quotes:

DLookUp("[Rate]","[tblRates]","[ID] = """ & Form![ID] & """ And [CompanyID]
= " & Form![CompanyID])
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hi,
>
[quoted text clipped - 15 lines]
> Thanks,
> Jody
Jody - 19 May 2008 19:43 GMT
Thanks Arvin.  It worked!

Jody

> Try this example, substituting your own field and table names:
>
[quoted text clipped - 25 lines]
> > Thanks,
> > Jody
 
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.