473,386 Members | 1,798 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,386 software developers and data experts.

Open form for corresponding combobox selection

Hi,
I have database with two forms(Login form & Info form) and a table. When I login with a user name , it has to open the "Info form" with the corresponding username's record. Please help me to fix this. Below this the code what I have now. Thank you
Expand|Select|Wrap|Line Numbers
  1.   'Open "Info_form" and pass the User_Name in OpenArgs parameter
  2.         DoCmd.OpenForm "Info_form", , , , , , Me.User_name
  3.        Forms("Info_Form").Button1.Visible = (Me.User_name = "Admin")
  4.         DoCmd.Close acForm, Me.Name
Apr 5 '12 #1
5 2415
Malathi
31
You are opening the form and passing the username. But you are not opening the recordset of the paricular user in the form and also not passing the values. I think this might be the point!
Apr 5 '12 #2
Hi malathi,
yes . what I have rite now is this. How and where to include the code to open the corresponding recordset.
Apr 5 '12 #3
Mihail
759 512MB
Try this:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "Info_form", , , "UserName = " & Me.User_name, , , Me.User_name
If don't work, post the implied tables structures.

PS:
Edit your preview post (click Edit button)
Select this text:
'Open "Info_form" and pass the User_Name in OpenArgs parameter
DoCmd.OpenForm "Info_form", , , , , , Me.User_name
Forms("Info_Form").Button1.Visible = (Me.User_name = "Admin")
DoCmd.Close acForm, Me.Name

Click the <CODE/> button, in order to appear like this:
Expand|Select|Wrap|Line Numbers
  1. 'Open "Info_form" and pass the User_Name in OpenArgs parameter
  2. DoCmd.OpenForm "Info_form", , , , , , Me.User_name
  3. Forms("Info_Form").Button1.Visible = (Me.User_name = "Admin")
  4. DoCmd.Close acForm, Me.Name
Do that from now when you post code !

Cheers !
Apr 5 '12 #4
Hi Mihail,
This is not workin. let me show you some other code.I have a drop down in the Infoform for admin,where he can view all the users through a drop down.I want something similar like this when a user login it should show their form.

User_ID = Me.NName.Value
DoCmd.SearchForRecord , "", acFirst, "[User ID] = " & "'" & Screen.ActiveControl & "'"
Apr 9 '12 #5
so the username comes from "User ID" and when the form opened by a user , it shold show up only his own record.
Please help me on this
Apr 9 '12 #6

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

Similar topics

2
by: allyn44 | last post by:
Hello, I have built a serch form for users to edit records. I only want them to pull up the record they need, and I want to check for nulls. There should not be dupes becasue the underlying...
3
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The...
14
by: keri | last post by:
Hi, Simple version of the question..... How do I use the where clause of the open form command to show an account with a matching ID to be displayed when the form is opened? Eg. I select a...
10
by: Beatrice | last post by:
I need to open a form selecting all data from a previous form i.e: Form 1) combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year") ...
5
by: billa856 | last post by:
Hi, My project is in MS Access 2002. In that I want to open one form multiple times. I put one button on my main form. Now whenever I click on that button than form will be open. Now when I...
4
by: Mtek | last post by:
Hi, We have a combo box on our page, which gets populated via a MySQL Query in PHP. What we want to do is to print the values on the page in a table that correspond the to selection from the...
1
by: ebasshead | last post by:
Hi Everybody, Behind a combo box on an open form, I have the below code to run a query, which it does, and pops up the query results.. MaxofID, NPPricePerWeek and IDProperty2, in data sheet view. ...
1
by: Emily Walshaw | last post by:
I'm sorry, I know this has been asked a million times, but am completely new to access and need idiot proof help. I have a database and I am struggling to get a field to update based on a combobox...
0
by: Moorthi chinna | last post by:
how to reload combobox in datagridview based on combobox selection in datagridview?
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.