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 / General 1 / September 2004

Tip: Looking for answers? Try searching our database.

CODE QUESTION

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 30 Sep 2004 13:52 GMT
Hi, I wrote this code,  It works except I need to reference a Table
called Employees,  How is this done?

If Display = EmployeeID Then
DoCmd.RunMacro "Log On"
Else
DoCmd.OpenForm "StartUp"
End If

(I know this is wrong, The problem is   Table.Employees.EmployeeID  How
is this table referenced?)

If Display = Table.Employees.EmployeeID Then
DoCmd.RunMacro "Log On"
Else
DoCmd.OpenForm "StartUp"
End If
Allen Browne - 30 Sep 2004 14:06 GMT
See:
   Getting a value from a table: DLookup()
at:
   http://members.iinet.net.au/~allenbrowne/casu-07.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi, I wrote this code,  It works except I need to reference a Table called
> Employees,  How is this done?
[quoted text clipped - 13 lines]
> DoCmd.OpenForm "StartUp"
> End If
DS - 30 Sep 2004 14:46 GMT
> See:
>     Getting a value from a table: DLookup()
> at:
>     http://members.iinet.net.au/~allenbrowne/casu-07.html

Hi,
This is what I came up with.  Only one problem, it always opens up the
"Invalid ID" form whether I put a valid number in or not.  Am I missing
something. Thanks.
DS

If Display = DLookup("EmployeeID", "Employees") Then
DoCmd.RunMacro "Log On"
Else
DoCmd.OpenForm "Invalid ID"
End If
Allen Browne - 30 Sep 2004 15:09 GMT
Not sure exactly what you are trying to do here.

Display is a text box or combo or something?
User is supposed to enter their number, and you want to lookup the Employees
table to see if that number is found in the EmployeeID field?

If that's the idea, try something like this:
   Dim strWhere As String
   strWhere = "EmployeeID = " & Me.Display
   If Not IsNull(DLookup("EmployeeID", "Employees", strWhere)) Then

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>> See:
>>     Getting a value from a table: DLookup()
[quoted text clipped - 12 lines]
> DoCmd.OpenForm "Invalid ID"
> End If
DS - 30 Sep 2004 15:33 GMT
> Not sure exactly what you are trying to do here.
>
[quoted text clipped - 6 lines]
>     strWhere = "EmployeeID = " & Me.Display
>     If Not IsNull(DLookup("EmployeeID", "Employees", strWhere)) Then

Thanks for your help.  I got it figured out'
DS
 
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.