Open A Record In A Form When Selected From List Box

Jan 19, 2005

Hi folks,

I have created a form, which extracts records from a table and displays them in
a list box. This works, but what I want to do next is highlight a single record in
that list box, click a button and have the record open in another form. This is
the code I have at present:

Private Sub DisplayEnquiry_Click()
On Error GoTo Err_DisplayEnquiry_Click
Dim dispCriteria As String

dispCriteria = "[SupportEnquiriesTable].[EnquiryID]='" & Forms![Search All].[ListSearch].Column(0) & "'"
DoCmd.OpenForm "Support Enquiries", , , dispCriteria
Exit_DisplayEnquiry_Click:
Exit Sub
Err_DisplayEnquiry_Click:
MsgBox Err.Description
Resume Exit_DisplayEnquiry_Click

End Sub

When I try this I get an error "The OpenForm action was canceled. You used a method of the DoCmd
to carry out an action in Visual Basic, but then clicked Cancel in a dialog box."

I've double-checked that I've typed in the correct names etc. so I am at my wits end!
Can anybody help me out?
Thanks

View Replies


ADVERTISEMENT

I Want To Open A Form To A Selected Record.

Mar 20, 2008

I have a form that updates records. When the user opens the form in data entry mode, it is too difficult to find the correct record. What is the most efficient and simple way to have the form open to a specific record?

Solutions I have considered are a popup form that the user will enter the equipment code (which is the unique identifier of all records). Also, the user may not know the record number, but they will always know the equipment code (which is a field in the "equipment" table).

But I am not sure of the best way/best order to do this.

Thanks.

View 14 Replies View Related

Open Form To Selected Record From Listbox

Dec 13, 2006

Yet another question.

I have a listbox on a form that show all Files for a particular volunteer. I have an "Edit File" button below the listbox to be able to edit that particular file. Is there a way about opening that form to that specific record without using a query?

Thanks
ScrmingWhisprs

View 12 Replies View Related

Open A Form With A New Record With Selected Info Already Filled In

Sep 29, 2006

Hi again,

One last one that's been niggling me - I just can't fathom the code... I bet it's very simple...

I have a Form ("frmJobSummary") that shows all the jobs for a customer - the customer is selected and the Customers ID is stored in a Control called "CustomerID" (It's just a number)

I have a button that opens up a new form... "frmEditJob" This allows you to add a job to a customer. I know how to get it to open up as a new record... but...

How do I get it to open up as a new record (or job) for the customer selected on the form "frmJobSummary"?

Here's the code so far... all it does is open the form with the Current record. :(

Your help is, as always, most appreciated!

Private Sub OpenNewJob_Click()
On Error GoTo Err_OpenNewJob_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEditJob"

stLinkCriteria = "[CustomerFK]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenNewJob_Click:
Exit Sub

Err_OpenNewJob_Click:
MsgBox Err.Description
Resume Exit_OpenNewJob_Click

End Sub

View 3 Replies View Related

Wrong Record Selected From Macro Of Open Form Button

May 1, 2012

I have a parent form showing some of the contents of a single record in a parent table. This form contains a button that opens a specific subform (using an IF statement based on the contents of another field in the parent table/form. There are actually any of 8 child forms/tables that could be selected and the related record is in only one of them. The relation between the tables is based on the PK of the parent table and the related FK in the child table. and the data is correct in all tables.

My problem is that when I run this button on the parent form/table it returns the appropriate form/table, but displays the first record rather than the related record. In the past (using this same process) I have been successful in getting to the right record by fiddling with the where statement (sometimes putting in a equal sign or taking it out fixes the problem). However, no matter what I do to the Where statement nothing works. I have not yet placed the final else condition for where the form selection field (VMValIdentType] is empty yet as there is no point at this time.

Here are the button macro contents:

If [VMValIdentType] = "Software"
OpenForm
Form Name: tmpVMValSW
View: Form
Filter Name:

[code]...

View 7 Replies View Related

Forms :: Access 2010 The Same Record Be Selected In Each List Box Within The Form With Tabs

Sep 21, 2013

I have a form with 3 tab controls. Within each tab, there is a bound list box that lists records based on a combo box selection. All list boxes are bound to the same table and records in each tab will be in the same order.

Tab1, listbox1:Field1, Field2, Field3, Field4
Tab2, listbox2, Field1,Field2, Field5, Field6
Tab3, listbox3:Field1, Field2, Field7, Field8,Field9

I would like the same record be selected in each list box within the tabs, e.g. when record #2 is selected on tab1, the same record will be selected on tab2 and tab3, or if I click on tab 2 again and change the selection to record #3, record #3 will be selected on tab1 and tab2.

View 3 Replies View Related

List Box Open Form New Record With The ID In

Aug 15, 2006

Hello everyone,
i have 2 tables,
table one =client detials
table two = job information
both have field called ClientNumber in them and have Relationships

i have a form with list box in it with ClientNumber(hidden), Surname, First name and i have a button and i want when i choose a name of list box and click button to open a job information form and be on new record and i want the ClientNumber to be put in the ClientNumber textbox on the form

so if u click on eg: David scown and click button want it to open form and be on a new record and put his Client Number in the client number text box

View 4 Replies View Related

Using List Box To Open A Form To Matching Record

Oct 21, 2005

I have four similar forms - they each have a list box and an "edit" button.

The user selects the item in the list box and clicks edit.

Another form pops up, open to the record that was selected in the list box.

This works in two forms, it doesn't work in the other two forms. Instead it pops up the first record in the table, regardless of what is selected in the list box.

The code is identical on all four "edit buttons." (with field names changed, of course.)

Code:Dim stDocName As StringDim stLinkCriteria As StringstDocName = "frmCaseTypeEdit"stLinkCriteria = "[Case_Type_ID]="&Me![listCaseTypes]DoCmd.OpenForm stDocName, , , stLinkCriteria
The properties in the listboxes are also the same on all four forms - based on a query, 3 columns, and bound column is the first one (which is the ID field).

Does anyone have any ideas what could cause this?

View 3 Replies View Related

Forms :: Open Form And Show First Record In A List

Oct 20, 2013

On a form I have a listbox that allows me to navigate around my records. The listbox is filtered and I get the redords that I waqnt from the table.My problem is that when I open the form the record that is showing is one from the table but not one that is in my listbox. I want it to show the first record in the listbox...This is the command I have on open:

Code:
DoCmd.GoToRecord , "", acFirst

which is where the fault lies, but I dont know what I should put in its place. The list is List273 and the form is frm_Profile

View 1 Replies View Related

Forms :: Code To Pick A Field From A Record Selected Via List

Dec 11, 2014

I have a query with the following structure;

aDate(pkey) cost1 cost2 cost3 calc1 calc2 calc3
01/012014 ,,,,,,,,,1,,,,,, 2,,,,,,, 3,,,,,, 1,,,,,,, 2,,,,, 3
01/02/2014 ,,,,,,,,1,,,,,, 2,,,,,,,, 3,,,,,, 2,,,,,, 4,,,,,, 6
01/03/2014,,,,,,, 1 ,,,,, 2,,,,,,, 3,,,,,,, 3,,,,,, 6 ,,,,, 9
01/04/2014 ,,,,,, 1,,,,,,,, 2,,,,,,, 3 ,,,,, 4,,,,,, 8,,,,,, 12

fields calc1,2,3 are running totals of cost1,2,3

I expect/hope to first calculate the sum of a cost field and then minus the value of its corresponding calc field from a specific record.

result = sum(cost1) - calc1 selected record value

I want to select the calc1 record from a drop down list of the primary key. Which cost field is in the equation will static/defined as I intend to make a textbox for each field.i need to know the code to pick a field(and retrieve it's value) from a record selected via dropdown list.

View 4 Replies View Related

Macro To Open Form When Report Is Selected

Sep 16, 2014

I have a report that is based on a query. The query has filters in it based on user info entered from a form. So the form asks the user to select which division of the company, and the date range for when the info applied to. My issue is that I am trying to set a macro that opens this form whenever some tries to open the report.

But the macro appears to run the query before it opens the form and it gives me a generic message box asking for the division. After I type that in (instead of selecting from a drop down list like I have on my form) another window pops up asking for start date, etc...instead of opening the form I created. What am i doing wrong and how do I get the macro to open my form? If I open the form directly and enter the criteria, it runs the report correctly.

View 7 Replies View Related

Forms :: Open New Form From Selected Group Of Records

Aug 8, 2013

I'm developing a database where people basically can fill in an order form and then the database can track if the order has been placed, when it came in etc.I have a form called frm_Suppliers to be Ordered that runs off a query. The tables that relate to the query are called tbl_Products, with a primary key called ID and tbl_Suppliers, with a primary key called Supplier ID.

The form called frm_Suppliers to be Ordered, shows a list of suppliers that have open orders. Each supplier may have several orders open. I want to be able to click a button after each supplier name and bring up a continuous form that relates to all the records from that supplier that have open orders.

I have tried using the code found in the thread called "open a form based on the record that is selected in current form" from 06-08-2011, however it will only work when my form lists each open order separately, not when they are grouped by supplier.

View 2 Replies View Related

Forms :: Double Click Event - Form Showing 1st Record Instead Of Selected Record

May 8, 2014

I am new to access and I recently encountered a double click issue

My form loads perfectly on double click event but it shows the first record instead of selected record.

My search is based on a PersonID but each PersonID has different WorkID that I wish to display on double click but it always shows the first WorkID instead of my selected record

I have tried changing the filters in the form properties but it still doesn't work for me.

Here's my code:

Private Sub SearchResults_DblClick(Cancel As Integer)
DoCmd.OpenForm "WorkForm", , , "[PersonID]=" & Me.[Searchresults], , acNormal
End Sub

[Searchresults] draws information from my Query

Query information:

PersonID... WorkID... Type......Location
1234..........1............Paint .....Address A
1234..........2............Electric...Address B
1234..........3............Floor..... Address C

View 7 Replies View Related

Remember The Selected Record - Requery - Then Go Back To Selected Record...

Jun 28, 2005

Hi guys,

Bit of a problem I'm hoping someone can help with. I have a telephone call logging system. The system is a tabbed form with each tab representing a person's Telephone Call Inbox. As new calls are entered into the database, they appear in each person's inbox until they are marked as dealt with.

This all works fine and there are no problems with the basics of it, but the problem I do have is that after I have split the database into a Back end and a Front end and distributed the Front ends to each user, when a new call is entered it doesn't appear in the persons inbox until they do a requery.

At first I sent the form to requery using the ontimer event, but the problem I have is that after every reqery the form goes back to the first record. A user on the office forum suggested I use the following code:

vCurrent = Me.Bookmark
Me.Requery
Me.Bookmark = vCurrent

But this gives me invalid bookmark errors, so I was then told to add

On Error Resume Next

But this stops the bookmark function working and instead the first record is loaded every 1 minute (as set by my timer).

Can anyone recommend a better way that actually works without invalid bookmark errors?

View 14 Replies View Related

Modules & VBA :: Retrieve / Validate Data On 2nd Form Based On Record Selected On 1st Form

Jul 29, 2013

Can I look up and verify data on a "second" form based on a selected record from first (still open) form.

I am trying to allow users to select a User Name from a combo box list and then open "Change Password" form when they select "Change Password" for that selected user name.

My problem is that I can't figure out how to associate and verify the data tied to the user name selected on the previous (Login) form ( I am trying to validate the old password tied to that selected record).

I have the first login form created, and it's working just fine. I also have the change password form created (and it's displaying the user name selected from the first form using:

Code:
Private Sub Form_Load()
With Forms![frmLogin]![cboUserName]
Me.txtPwdChgUserID = .Column(2, .ListIndex)
End With
EndSub

I also have the code written to validate and confirm old password, new password and validate new password (when the save button is clicked). I have yet to update the password with the new password (still trying to figure that out).

Attached zip file has screen shots of the two forms.

View 3 Replies View Related

Open Up A Form From A List Box

Nov 2, 2006

I have a form with a list box on it, I want to be able to open another from with a click on an item in the list box and populate a list box on the second form.

So lets say on the ist forms list box I have Beef, Pork and Lamb, if choose Beef, I want to open the new form and populate the list box with a list of Beef items. Any help is appreciated.

View 1 Replies View Related

Setting A Combo To The Record Selected In A Form

Feb 8, 2005

Hello,

I suspect this is probably rather easy, but I've not been able to figure it out:

I am using a combo to select a record in a form. This works.

The problem is: When I navigate through the records in the form, the combo box does not "update". I need to be able to change the record displayed in the combo box as the record in the form changes.

Any ideas?

Many thanks in advance for assistance.

View 8 Replies View Related

Find A Record On Form Based On Value Selected In Combo Box

Jun 2, 2014

I am trying to add a combo box into a form and when the Combo Box wizard pops up I only get two choices:

I want combo box to get values from another table or query. I will type in the values I want

I want the third option...

Find a record on my form based on the value I selected in my combo box.

Why am I not getting the third option??

View 1 Replies View Related

Open A Form Depending On Selection Off List Box

Aug 23, 2006

Hi

I have a form, with 2 Combo Box's and a List Box. The Combo Box's provide a search criteria and the results are displayed in the list box [searchList].

I want to be able to double click a record in this List box [searchList] and that will open a from [frm_SearchDisplay] with the selected record from that List Box [searchList]

Can someone please point me in the right direction.

Thanks in Advance

H

View 2 Replies View Related

Filtering A Form From A Selected Record On A Pop-up Form

Jan 25, 2005

I've search around the forum and haven't come up with the answer yet.

So here goes...

I have a main form (GRCSearch) that is tied to a table (StoredSearches). When users enter data in this form it saves it to the table. It is a single record form. The data entered by the user is used to search a big second unbound table via some queries.

The search data entered is then recorded to the table (StoredSearches) as a way for the user to track searches and to recall them if they want to run the same search again.

I've created a pop-up form that displays a continuous record layout of the StoredSearches table and a command button at the left of each record.

I want the user to be able to click the command button to the left of each record in the pop-up and that in turn set the focus of the main form to that record. It recalls the search data, repopulating the search fields of the main form. And in the onclick event I'll also have it close the pop-up window.

I however cannot find any references to setting the focus from one form to another form this way. I've found plenty that changes the focus of a form from an embedded subform.

Any ideas?

Thanks!!

Scott Doyle

View 1 Replies View Related

Forms :: Display Button On Selected Record In Continuous Form

Oct 30, 2014

I have continuous form in Access 2010. I highlight selected record. Now I would like when user will select record, that record will display button to give ability user delete it. For not selected records button not visible and disable. How to display button only in selected record in continuous form?

View 2 Replies View Related

Record Lookup In Form Flashes One Or More Records Before Displaying The One Selected

Dec 3, 2014

I have a form (Student Details) that has an unbound lookup box using a query to select a student. The lookup has the hidden Student ID autonumber key field plus Class Number, Last Name, First Name, Status, sorted by Class Number (descending), Last Name, First Name.

The form record source is a similar but unsorted query.

There are nearly 1000 student records. The form has pages (tabs). The lookup box is in the form header. There are dozens of fields in the 1st Page (General) including an picture (attachment, not hyperlink) field holding a photo of the student, the other 6 pages have less.

When you select a student via the look up, at least one sometimes more students "flash" before it displays the one you want, which seems to display twice before it stops.

I deleted the picture field to see what difference that made, because it seemed to do the most flashing, and indeed, without that field you go right to the record. I looked at the Student table indexes and it seems that field type is not index-able, which is understandable.

Is there any way to improve this with still leaving the photos as attachments? Some thoughts:

It improves if it is displayed first as an Icon or Paper Clip, and probably would if a hyperlink field, but we like to have the picture displayed and not have to open the link to see it nor worry about the location changing invalidating a link. It seems that if the record was displayed with the picture field only filled after all the other fields were filled it would make for a better impression.

Can an On Load form event VBA or Macro be written that either hold the picture back until the rest of the fields are displayed or if an icon or changed to a hyperlink to open. Would it work if the pictures were attached to a separate joined table?

View 11 Replies View Related

Duble Click On List Box To Open Form And Subform

Apr 7, 2008

I have the following code attached to a form:
Private Sub Go_To_Project_Click()
On Error GoTo Err_Go_To_Project_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Project Main"
stLinkCriteria = "[R&D ID#]=" & Me![lstsearch]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Go_To_Project_Click:
Exit Sub
Err_Go_To_Project_Click:
MsgBox Err.Description
Resume Exit_Go_To_Project_Click
End Sub

Private Sub txtsearch_AfterUpdate()
Me.lstsearch.RowSource = "Select [R&D ID#], [SKU#], [Project Name], [Construction level], [Manufacturer], [Hobbico Status], [R&D Work By], [Product Manager], [Desktopper]" & _
"From [Project Main]" & _
"Where [Project Name] like '*" & Me.txtsearch & "*'" & _
"OR [SKU#] like '*" & Me.txtsearch & "*'" & _
"OR [R&D Work By] like '*" & Me.txtsearch & "*'" & _
"OR [Product Manager] like '*" & Me.txtsearch & "*'" & _
"OR [Desktopper] like '*" & Me.txtsearch & "*'" & _
"OR [R&D ID#] like '*" & Me.txtsearch & "*'"
Me.lstsearch.Requery
End Sub


Private Sub Exit_Search_Click()
On Error GoTo Err_Exit_Search_Click
DoCmd.Close
Exit_Exit_Search_Click:
Exit Sub
Err_Exit_Search_Click:
MsgBox Err.Description
Resume Exit_Exit_Search_Click
End Sub

Basically a text string is entered in the txtbox and a list of matching records shows up in lstsearch box. One selects the desired record in the lstsearch and clicks on the "Go to project" button and the appropriate form (aka "Project main") and subform (aka Project History) open up with the desired record and record history.

What would I need to add to lstsearch so the users can double-click on the record to open it instead of selecting it and clicking on the "Go to project" button?

Thanks

mafhobb

View 10 Replies View Related

Forms :: Cannot Open Form By Double Clicking List Box

May 3, 2014

When double click the entries given in the attached database I cannot open the correct form. it gives parameter value.

View 4 Replies View Related

Forms :: Main Form Show Record Selected Within Datasheet Subform

Sep 30, 2013

The situation is i have two forms, looking at the same table, but the main table shows more records, I would like to select a record in the datasheet subform and have the main form flick through to the corresponding record.

View 5 Replies View Related

Forms :: Open A Form For Adding Child Record Related To Highlighted Record In Subform

Oct 2, 2013

Is it possible to open a form to add a child record related to the highlighted record in the subform?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved