Open form to a particular record

Hi,

I have a continuous form listing some employees. One of the fields displayed
is the EmployeeID field. Is it possible to double-click a particular
EmployeeID field on the continuous form and another form (called
"frmEmployees") open and display the record for the employee that I double
clicked?

I tried the following code and the frmEmployee form opened but at the first
record, not the record for the person I double-clicked in the continuous form.


*********************************
    Dim strWhere As String

    strWhere = "[EmployeeID] = """ & Me.[EmployeeID] & """"
    DoCmd.OpenForm "frmEmployees", , , strWhere

*********************************

Thanks,
Anthony

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1

0
biganthony
11/13/2007 10:55:49 AM
access.forms 6864 articles. 2 followers. Follow

7 Replies
755 Views

Similar Articles

[PageSpeed] 7

Hi,

Forgot to add, EmployeeID field is a text field.

Anthony.



biganthony wrote:
>Hi,
>
>I have a continuous form listing some employees. One of the fields displayed
>is the EmployeeID field. Is it possible to double-click a particular

-- 
Message posted via http://www.accessmonster.com

0
biganthony
11/13/2007 10:59:10 AM
Dim strWhere As String
strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
DoCmd.OpenForm "frmEmployees", , , strWhere

The quotes are like this:

Double quote before [EmployeeID].
Single quote, then double quote after the =

Double quote, single quote, double quote at the end.

"biganthony via AccessMonster.com" wrote:

> Hi,
> 
> I have a continuous form listing some employees. One of the fields displayed
> is the EmployeeID field. Is it possible to double-click a particular
> EmployeeID field on the continuous form and another form (called
> "frmEmployees") open and display the record for the employee that I double
> clicked?
> 
> I tried the following code and the frmEmployee form opened but at the first
> record, not the record for the person I double-clicked in the continuous form.
> 
> 
> *********************************
>     Dim strWhere As String
> 
>     strWhere = "[EmployeeID] = """ & Me.[EmployeeID] & """"
>     DoCmd.OpenForm "frmEmployees", , , strWhere
> 
> *********************************
> 
> Thanks,
> Anthony
> 
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1
> 
> 
0
Utf
11/13/2007 11:16:01 AM
Brian,

Thanks for replying. I changed my quotes but the same problem exists - the
frmEmployee form opens but always at the first employee's record.

Does it make any difference if the continuous form is not a data entry form?
It displays the data about the employees and I would like to double click
their ID and have their employee record in the frmEmployee form open.

Anthony



Brian wrote:
>Dim strWhere As String
>strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
>DoCmd.OpenForm "frmEmployees", , , strWhere
>
>The quotes are like this:
>
>Double quote before [EmployeeID].
>Single quote, then double quote after the =
>
>Double quote, single quote, double quote at the end.
>
>> Hi,
>> 
>[quoted text clipped - 17 lines]
>> Thanks,
>> Anthony

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1

0
biganthony
11/13/2007 8:49:15 PM
Then, let's look at whether the strWhere is getting the correct information. 
Try this:

Dim strWhere As String
strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
MsgBox "strWhere = " & strWhere
DoCmd.OpenForm "frmEmployees", , , strWhere

Copy & post back here the results of the MsgBox. It should look something 
like this:

[EmployeeID] = 'jsmith'

The second question is whether the form being opened has EmployeeID in its 
RecordSource, so also copy post here the RecordSource of the form being 
opened. It should look something like this:

SELECT * from EmployeeTable

(but we need to make sure EmployeeID is a field in the EmployeeTable)

"biganthony via AccessMonster.com" wrote:

> Brian,
> 
> Thanks for replying. I changed my quotes but the same problem exists - the
> frmEmployee form opens but always at the first employee's record.
> 
> Does it make any difference if the continuous form is not a data entry form?
> It displays the data about the employees and I would like to double click
> their ID and have their employee record in the frmEmployee form open.
> 
> Anthony
> 
> 
> 
> Brian wrote:
> >Dim strWhere As String
> >strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
> >DoCmd.OpenForm "frmEmployees", , , strWhere
> >
> >The quotes are like this:
> >
> >Double quote before [EmployeeID].
> >Single quote, then double quote after the =
> >
> >Double quote, single quote, double quote at the end.
> >
> >> Hi,
> >> 
> >[quoted text clipped - 17 lines]
> >> Thanks,
> >> Anthony
> 
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1
> 
> 
0
Utf
11/14/2007 12:17:01 AM
Brian,

Thanks for replying.

I already checked whether the strWhere is getting the correct information by
printing a message box. It is getting the correct information.

Also the record source for the form is as you have written. (SELECT * FROM
tblEmployees;)


The only way I have got it working is with the following code :

***********************************************************************
    strWhere = "[EmployeeID] = '" & Me.EmployeeID & "'"

    DoCmd.OpenForm "frmEmployees", , , , , acHidden
            
    DoCmd.OpenForm "frmEmployees", acNormal, , strWhere, acFormEdit,
acWindowNormal

***********************************************************************

It seems to only work when the frmEmployees form is already open prior. 
I don't know what has happened!

Anthony



Brian wrote:
>Then, let's look at whether the strWhere is getting the correct information. 
>Try this:
>
>Dim strWhere As String
>strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
>MsgBox "strWhere = " & strWhere
>DoCmd.OpenForm "frmEmployees", , , strWhere
>
>Copy & post back here the results of the MsgBox. It should look something 
>like this:
>
>[EmployeeID] = 'jsmith'
>
>The second question is whether the form being opened has EmployeeID in its 
>RecordSource, so also copy post here the RecordSource of the form being 
>opened. It should look something like this:
>
>SELECT * from EmployeeTable
>
>(but we need to make sure EmployeeID is a field in the EmployeeTable)
>
>> Brian,
>> 
>[quoted text clipped - 23 lines]
>> >> Thanks,
>> >> Anthony

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1

0
biganthony
11/14/2007 2:54:31 AM
What happens when you hard-code a reference to a specific employee ID in the 
OpenForm method?

Like this:

DoCmd.OpenForm "frmEmployees", , , "[EmployeeID] = 'jsmith'"

Does this work? If so, then try this:

strWhere = "[EmployeeID] = 'jsmith'"
DoCmd.OpenForm "frmEmployees", , , strWhere

Does this work?

"biganthony via AccessMonster.com" wrote:

> Brian,
> 
> Thanks for replying.
> 
> I already checked whether the strWhere is getting the correct information by
> printing a message box. It is getting the correct information.
> 
> Also the record source for the form is as you have written. (SELECT * FROM
> tblEmployees;)
> 
> 
> The only way I have got it working is with the following code :
> 
> ***********************************************************************
>     strWhere = "[EmployeeID] = '" & Me.EmployeeID & "'"
> 
>     DoCmd.OpenForm "frmEmployees", , , , , acHidden
>             
>     DoCmd.OpenForm "frmEmployees", acNormal, , strWhere, acFormEdit,
> acWindowNormal
> 
> ***********************************************************************
> 
> It seems to only work when the frmEmployees form is already open prior. 
> I don't know what has happened!
> 
> Anthony
> 
> 
> 
> Brian wrote:
> >Then, let's look at whether the strWhere is getting the correct information. 
> >Try this:
> >
> >Dim strWhere As String
> >strWhere = "[EmployeeID] = '" & [EmployeeID] & "'"
> >MsgBox "strWhere = " & strWhere
> >DoCmd.OpenForm "frmEmployees", , , strWhere
> >
> >Copy & post back here the results of the MsgBox. It should look something 
> >like this:
> >
> >[EmployeeID] = 'jsmith'
> >
> >The second question is whether the form being opened has EmployeeID in its 
> >RecordSource, so also copy post here the RecordSource of the form being 
> >opened. It should look something like this:
> >
> >SELECT * from EmployeeTable
> >
> >(but we need to make sure EmployeeID is a field in the EmployeeTable)
> >
> >> Brian,
> >> 
> >[quoted text clipped - 23 lines]
> >> >> Thanks,
> >> >> Anthony
> 
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1
> 
> 
0
Utf
11/14/2007 6:33:00 AM
Brian,

Thanks for your assistance.

The line of code you suggested does not work - it opens at the first record
(again). ( I did change to an employee ID that I know does exist in the
original form/table.)

If I precede it with: 

DoCmd.OpenForm "frmEmployees", , , , , acHidden

it works.

Anyway, It works with that line in so I will keep it as it is.

Anthony


>Like this:
>
>DoCmd.OpenForm "frmEmployees", , , "[EmployeeID] = 'jsmith'"
>
>Does this work? 



>> 
>[quoted text clipped - 49 lines]
>> >> >> Thanks,
>> >> >> Anthony

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1

0
biganthony
11/14/2007 8:02:45 AM
Reply:

Similar Artilces:

Report
I want to build (1) report and have my Record Source be one of three queries based on a selection in an option box on a form. Can I do this? If so, do you have any coding that might get me started? OR Do I need to create three reports and use each query as the record source? Thanks If you have Access 2003 + you can use Reports!MyReportName.RecordSource = "MyQuery" where MyQuery is the name of the query you wish to change to. I don't know if it works with earlier versions. Evi "NEWER USER" <NEWERUSER@discussions.microsoft.com> wrote in message news:6C9AA...

faxing form
Is there a way to fax the form page via the fax modem on my computer? Create a report based on your form then fax the resulting report. Take a look at http://support.microsoft.com/Default.aspx?kbid=231797 hopefully it is what you are looking for. -- Hope this helps, Daniel Pineault If this post was helpful, please rate it by using the vote buttons. "He cries for help" wrote: > Is there a way to fax the form page via the fax modem on my computer? "He cries for help" <Hecriesforhelp@discussions.microsoft.com> wrote in message news:252D07EA-5886-4B0C-99...

reference to master form
Hello there I have master form and inside there is subform. If an event procedure uccur on subform, how can i get refence to the master form in order to change there things when the name of the master form is diffrent always? Roy Look in Access HELP for the "Parent." property. Your code will look something like: Me.Parent.... from within the subform. -- Regards Jeff Boyce www.InformationFutures.net Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ "Roy Goldhammer" <roy@ho...

Money 2006 won't open
Recently had problems with the IE8 upgrade. It screwed up everything so much that I'm back with IE6, which seems to be working OK. But now MS-Money won't open. The msmoney.exe file is running because I can see it in Task Manager. Even when I end the process in Task Manager, the program still won't open on the desktop. Rebooting doesn't solve anything. Any ideas? Windows XP, SP3 Have you tried: 1) Opening the Money Sample data file? (This will isolate problems with your data file from problems with the application itself.) 2) Reinstalling Money? "snavegerg...

How can I refresh the master form from a subform?
Hello. On the After Update of the subform I am trying to refresh the Master form. I have tried things like Docmd.requery and Me.Refresh, but not sure what I am doing. Can you help me with this? Thanks. Iram Iram wrote: >On the After Update of the subform I am trying to refresh the Master form. I >have tried things like Docmd.requery and Me.Refresh, but not sure what I am >doing. Try using: Parent.Requery -- Marsh MVP [MS Access] ...

Modal Form from a child form
Hi, I have a little problem, I have a MDI form (Main Menu), this form open a child form (A), and I need to open a form B as modal form from form A. I can to this with showDialog(), but it open form B outside MDI form (Main Menu) and it is showed on the windows bar as another application opened. So the question is, there are any way to open a modal form from a child form inside a MDI form? Thanks El Alquimista wrote: > Hi, I have a little problem, I have a MDI form (Main Menu), this form > open a child form (A), and I need to open a form B as modal form from > form A. I c...

Message Stuck in Outbox to Only One Particular Email Address
Hi: I have Outlook 2007 and have been using it for about 2 months or so. I have encountered a problem with sending emails. I have sent emails to a particular email address (WinTips-Tricks@yahoogroups.com ) and the emails get stuck in the outbox. The CPU usage is very high (about 76%) and the taskbar icon flashes furiously. If I look in the outbox, the email is also doing a staccato flash. At the bottom of Outlook the send says complete, yet the flashing taskbar icon, and flashing email in the outbox remain. After awhile (about 2-3 minutes) this stops, but the email remains in the outbox....

Data source for PivotTable-Form in ACCESS 2000
Hi, this drives me crazy, 4 years ago I defined in an ACCESS 2000 application a "PivotTable-Form". The resulting EXCEL table inclusive the "Data refresh" works perfect. I now want to update/change the query for the "Data Source" but cannot find which query is behind the "PivotTable-Form" or behind the resulting EXCEL spreadsheet. When editing the properties for the "PivotTable-Form" or the EXCEL spreadsheet the "Data Source" is always blank. Question: Where does Access 2000 or EXCEL 2000 hide the respective data source (Query)...

double opening files
When I try to open an Excel file, MS Excel seems to open the document twice, thereby creating an error the second time it opens and will only open a read-only document saying someone else has it open. Is this is BUG and is there a PATCH I can download? This is with MS Excel 97 on an NT platform thanks Elaine ;) I got a similar problem using Excel 97 on an Windows XP machine, which was soved by uninstalling then reinstaling Excel 97. hth AndyO "elaine" <anonymous@discussions.microsoft.com> wrote in message news:0b0c01c3b03f$cdbd2860$a301280a@phx.gbl... > When I try ...

Media players opens and keeps trying to refresh about 5 times a mi
I have done numerous spyware chaecks all showing nothing detected I have eliminated any options in the media player that would have it trying to check for updates or web items. Completely at a loss and extremely unhappy the microsoft site does not have an answer. Acer Exyenza Laptop with Win XP , Office 07 and player 11 any help guys? in the time in took to type this meassage the player popped up three times Try disabling (unchecking) all active WMP plug-ins in WMP's Options. If you download and run Process Explorer - http://technet.microsoft.com/en-us/sysinternals/bb8...

error opening ppt file
I have office 2007 installed but when i try to open a ppt file created by some one it says powerpoint can't read the outline . No text converter is installed for this file type. karan In article <a888f8cd-1391-4124-80c0- 631197290d7a@y28g2000prd.googlegroups.com>, Guddu wrote: > I have office 2007 installed but when i try to open a ppt file created > by some one it says powerpoint can't read the outline . No text > converter is installed for this file type. Have a look here: "PowerPoint can't open the type of file represented by [FILENAME]"...

In what order do installed AddIns open?
I had no joy with my other post 'Trying to read CustomDocumentProperties of an open 2007 AddIn Options ' so I'm trying another tack... To work around a problem I'm having, since upgrading a complex tool to Excel 2007, I need to ensure that my Version Checker AddIn always opens before my Engine AddIn. Is there any useable logic that dictates the order in which Excel opens its installed AddIns (e.g. alphabetical, order of installation, position in list) or is it one of those unknown internal processes that will forever remain a mystery? Br, Nick. First Com...

Page not found error when opening business portal
Hi We're trying to install Invoice Approvals and Accruals 8.0, sharepoint services sp2 and Business Portal 2.5 Feature Pack to work with Great Plains 8.0 We can install Sharepoint services and Invoice Approvals and Accruals ok and they work fine However, when we install Business Portal and browse to http://servername/sites/businessportal/ We receive a "page not found" error screen We've tried several things but nothing seems to work Sharepoint services is installed in server farm mode and has been configured correctly (as far as I can tell) Any help would be great...

Problem opening up current Excel wksht to mail merge in Word
Hi, I have Microsoft 2007. I created a list in Excel with clients' name, address, city, state, zip. Then, in Word I go to Select Recipients, locate the Excel file and click open. Here's the problem: a Select Table box appears with Sheet1$, Sheet2$, and Sheet3$ as options. clicking on any of the three results in NOTHING. Nothing at all appears! I'm not sure what the problem might be. Thank you for the help! Rachelle ...

Remove records from lookup
Not sure if this is possible but I would like to remove all records except the account records from the look up records dropdown menu of the appointment entity. The associated schema is regardingobjectid and the label is regarding. I see the other entities listed under relationships but there is no option to delete. Is there a way to create a new lookup and have it added to my appointment form? Thanks. There is no supported way to change this. The system is setup to allow you to set appointments that are related to specific records (Opportunities, Quotes, Cases, etc) and it will then ro...

Cash Drawer won't open on transaction
Our client just replaced a PC after a H/D failure and everything is back up and working other than the cash drawer. It's connected to a Star SP200 serial printer on COM1. The printer works fine. The printer and the drawer both test fine from the Star OPOS configuration utility. Also, both are visible and test fine from the device screen in Store Ops (Shift + Ctrl + F5). We've already removed and reinstalled the Star drivers and tried a couple different versions. So now what...? BMI, Did you install Star's Cash Drawer OPOS driver too? Look in the Star folder for the Cash ...

vb script for opening notepad
Hi, I am a newbie to vb...Can somebodyprovide me a simple vb script for opening notepad in vista using windows shell Thanks VB baby "Melvin" <whereismelvin@gmail.com> wrote in message news:41a15213-b062-41f5-8525-7eb95c68864a@s22g2000prd.googlegroups.com... > Hi, > > I am a newbie to vb...Can somebodyprovide me a simple vb script for > opening notepad in vista using windows shell What version of VB are you planning to use? This group is for VB classic(VB6 or lower) which is very different from VB.Net(sometimes called VB 2005/2008). If this ...

Tying tables to forms
I have four connected tables that work well as table input but when I put them in a form some of the fields will not let me make entries. Does this happen because I am using the Id fields and subsequent data from the wrong tables? -- Taylor It sounds like you have created a non-updatable form. One cautionary note first: Don't tie your forms directly to the tables. Use queries instead. The queries will act as a stop light for which data is written and when. If more than one person tries to make a change to the same record at the same time, you will run into problems. From wha...

Outlook help
Hello. After years of using Outlook on my Windows XP machine, now I get the following error: Cannot start Microsoft Office Outlook. Unable to open the Outlook window. The set of folders could not be opened. The server is not available. Contact your administrator if this condition persists. Can anyone help? Where is the actual data kept? Can I retrieve it? Can you open Outlook in Safe Mode by using the /Safe switch? If you need help using Outlook command line switches, look here: http://support.microsoft.com/default.aspx?scid=kb;en-us;296192 -- Jocelyn Fiorello MVP - Outlook ...

Stop Buttons showing when opening up form
I have a button on my Main Start up page that when click makes these buttons visible, but when I open up my DB they automatically show on start up, is it possible they not be visible till I click ckbHelp.......Thanks for any Help.....Bob Private Sub ckbHelp_Click() If ckbHelp = True Then cmbHelpNewHorse.Visible = True cmbHelpActFinHorse.Visible = True End If If ckbHelp = False Then cmbHelpNewHorse.Visible = False cmbHelpActFinHorse.Visible = False End If End Sub Bob, In design view, set the property pf the *button* Visible=No Regards/Jacob "Bob" <xxx@xx.xx> wrote i...

Using Excel to design business forms
I have been using excel hit and miss to design business forms. I have been pretty successful but in many places I have found myself doing many inelegant things to get stuff to layout. Is there a good place to start looking to see how this is done properly, as I have seen many well done forms produced in excel. ...

List all row source for all forms, reports etc.
Hi I'm doing some work cleaning out old unused forms, reports and queries. I have been going through each report in a database (There are A LOT), determining its row source query, then marking it for deletion. I will eventually end up going through and deleting all the unused queries. As you can imagine this is time consuming, and I was thinkg 'there must be a FASTER way" Does anyone have a suggestion, or link to a pre-built function or model that could assist me? Regards Darragh On Thu, 17 Jan 2008 22:14:18 -0800 (PST), Darragh <darragh.murray@gmail.com> wrote: >Hi...

Cannot view any form in crm 3.0
We have just installed CRM 3.0 on MS server 2003. I have created an account which has a system administrator role assigned to it. The issue is that when I open CRM web (on the server) when I select account, contact, activities, calendar etc... I get the following error: An error has occured. For more information, contact your system administrator. Now if I open CRM web using an account which has restricted access mode ticked, I don't get any errors, everything opens fine. The problem is that with an restricted access code i can't do much. I have tried assigning different roles ...

Bug with controls location and scrollbars in a Windows Form
Hi, I've noticed a bug with WinForm and scrollbars, and I would like to know if there is a workaround ... Bug description : ------------------------ 1) create a win form, and add 3 buttons : * FirstButton : upper left corner of the winform * SecondButton : location = (0 ; 600) * ThirdButton : location = (100, 600) 2) Set : ThirdButton.Visible = false 3) Set the Form size to 100 x 100 ... and set : AutoScroll = true 4) Add the following event handler to the Click event of FirstButton and SecondButton ... private vo...

ACCESS 2000 is deleting records
Just yesterday I converted an Access 97 database to Access 2000. Have a large problem I need help with. After converting the DB I "split it" in order to use it as a backend, same way it was in Access97. After converting the database to Access2k we began to have a problem with Access2k deleting records. it deleted a total of 4 out of 62 records. the records are not together ( record #289365 then 289048 then 289128 then 289178 then this morning 289405) these record are auto-numbered incerement of one. They were entered by different people so I know its not just an operator probl...