473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Environ("USERNAME") first record

HI
IM making project by simple "open the form base on your computer name"
I'm recovering the user name of the computer but my problem is it only work if the user in the first record

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Command2_Click()
  2.  
  3. Dim CHECKINGMEEE As String
  4. Dim ashift As String
  5.  
  6. CHECKINGMEEE = Environ("USERNAME")
  7.  
  8. ashift = DLookup("[User Name]", "a shift NAME")
  9.  
  10. bshift = DLookup("[User Name]", "b shift NAME")
  11.  
  12. cshift = DLookup("[User Name]", "c shift NAME")
  13.  
  14. dshift = DLookup("[User Name]", "d shift NAME")
  15.  
  16. If CHECKINGMEEE = ashift Then
  17.  
  18. DoCmd.OpenForm "A shift HISTRY"
  19.  
  20. ElseIf bshift = CHECKINGMEEE Then
  21.  
  22. DoCmd.OpenForm "B shift HISTRY"
  23.  
  24. ElseIf cshift = CHECKINGMEEE Then
  25.  
  26. DoCmd.OpenForm "C shift HISTRY"
  27.  
  28. ElseIf dshift = CHECKINGMEEE Then
  29.  
  30. DoCmd.OpenForm "D shift HISTRY"
  31.  
  32. Else
  33.  
  34. DoCmd.OpenForm "ANYTHING"
  35.  
  36. End If
  37.  
  38. DoCmd.Close acForm, "ENTER FACE"
  39.  
  40. End Sub
Apr 11 '18 #1
1 1165
twinnyfo
3,653 Expert Mod 2GB
boyaqoub,

Welcome to Bytes!

First, we would love to help, but you have not provided a lot of information for us. I can make some assumptions about your database and its table structures, but those would only be guesses (even though, based upon my experience with folks who are newer to Access, many of my guesses would be correct). Based upon how I think you have your tables set up, I may have some structural changes to recommend and a very simple solution. However, if my presumptions are incorrect, those recommendations would be meaningless and unhelpful to you.

Please review this article on Asking Good Questions, and if you have additional clarification, we would be glad to chime in.

Also, there is a rather lengthy article on How to Create User Permissions in a Database. This may be above your skill level at this time, but it may help you see some very viable opportunities for your current database.

Please know that we are not "blowing you off". We want to help--but we need additional information from you in order to provide a viable solution without wasting our time by guessing what you need.

Hope this hepps!
Apr 11 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Rick | last post by:
Hi all, Is there a MySQL function to get the first record through a query? I would like to open a page of client records with the first one shown. The other records can be accessed from a...
5
by: Bob | last post by:
Hi, I am using Access 2000 to print out an address book. I have designed the report based on a database whose first record is not blank. In the design there is a one line report header, a onle...
3
by: Jason A. Thompson | last post by:
Dear Access Gurus, I have a database which I hoped to use to administer questionnaires, or rather that someone who knows nothing about Access could use to administer them. Each q'aire item is on...
1
by: jv | last post by:
I have quite a few of continuous form and subform where I do allow scroll bars. I run into problems with the mouse wheel whenever the data on the form does not take up the whole page. In this...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
0
by: James | last post by:
I have a bound combo using a lookup table which is behaving as expected with the exception of the first record. In the list of rows for my combo, the first is '.'. This is because of another...
0
by: hagar | last post by:
Hi all, I have a problem which I can not understand why this is happening! Debugging this I actually see that it grabs first record then when stepping through code to the line rsImportTo.AddNew...
2
by: Wayne | last post by:
Is there a workaround to the bug that loses the first record in a continuous form after using the scroll wheel if the available records don't fill the form? I know that the "up arrow" section of...
1
by: Hubert Wisniewski | last post by:
Hi, I have a problem with first record in my table. I put the data to the table and it's ok, but if I add second row to the table the first record is updated (and has the same value as the...
1
by: Jammin140900 | last post by:
Hi all, I'm new to all of this and this is probably straight forward. I have a form which is basically to be used like a checklist for a set of business processes in processing an application form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.