473,396 Members | 2,034 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,396 software developers and data experts.

Change form and display record from previous form

I am using a combobox lookup on one form and would like to use the value returned from that lookup to display a record on another form. Here is the select statement:

SELECT tblJob.JobNumber, tblJob.CustomerName, tblJob.PO, tblJob.[Customer Motor #], tblJob.assm_status FROM tblJob WHERE (((tblJob.assm_status)<>"Done")) ORDER BY tblJob.CustomerName;

Column 1 is the bound column

Here is the after update code

Private Sub CustomerSearch_AfterUpdate()
On Error GoTo Err_customersearch_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim acct As Integer
acct = Me.CustomerSearch.Value
stDocName = "frmOESJOBmaint"
DoCmd.OpenForm stDocName, , , "[jobnumber] = acct"
Exit_customersearch_Click:
Exit Sub
Err_customersearch_Click:
MsgBox Err.Description
Resume Exit_customersearch_Click
End Sub

When I run it asks for the parameter value of "acct" and if I key the jobnumber in it will display the proper form and record. Please help me understand what is wrong.

Thanks
Mar 26 '10 #1
2 1339
Hi erniemack,

Try below code. I hope it should work but i didn't try it.
Private Sub CustomerSearch_AfterUpdate()
On Error GoTo Err_customersearch_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim acct As Integer
acct = Me.CustomerSearch.Value
stDocName = "frmOESJOBmaint"
DoCmd.OpenForm stDocName, , , "[jobnumber] = YOURFORM!acct"
Exit_customersearch_Click:
Exit Sub
Err_customersearch_Click:
MsgBox Err.Description
Resume Exit_customersearch_Click
End Sub
Replace YOURFORM with the name of Form which contain CustomerSearch Combobox.

Hope this helps
Mar 27 '10 #2
I used
DoCmd.OpenForm stDocName, , , "[jobnumber] = " & acct
It worked. Thanks for the response
Mar 27 '10 #3

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

Similar topics

4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
5
by: Steve Strik | last post by:
My Problem: I have created a database here at work that is exhibiting some very strange behaviour. Essentially the database is structured in a manner where one table is a master record table...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
14
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
4
by: Rob Kroese | last post by:
I've got a form with a datagrid that displays a list of items, along with several textboxes, comboboxes, etc., that display the details for the selected item. The columns in the datagrid and the...
1
by: bgreenspan | last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am doing and what I tried. My database has entries with Contract Names and Expiry Dates, among other fields. I have a form...
36
by: beebelbrox | last post by:
Hi, I am new VB programming in Access and I am requesting help with the following code. WIndows OS MSaccess 2003 This code is attached to an unbound form that will display a specific recordset...
3
by: phil67b | last post by:
Hello everybody, I have a page rech.php where I'm doing a multi-criteria research Ex. choose your car model, choose your country. After validation of my form, on the same page, the lines will be...
4
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
11
by: dizzydangler | last post by:
Hi, all! I'm a new user, looking to get some help on a form problem in MS Access 2007 I haven't been able to crack. I've built a form that prompts users to enter new record data, then click...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.