473,769 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access '97 - How do i return a record of data from a list box presented in a form

33 New Member
Hi,
New user here and using a ms access 97 database.
I have a form containing a list box which presents the contents of a table.

On double clicking a record, i need the record to be presented in a new form where further data can be added.

I set the event procedure against the list box on Double Click, i can then use the DoCmd.OpenForm "frmDataEnt ry" but how do i pass the value that ive selected (double clicked), to then populate the form?

Many tks
Jan 30 '09 #1
18 1873
DonRayner
489 Recognized Expert Contributor
the DoCmd systax is as follows

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
You would be looking to set the WhereCondition which would make your docmd look something like this

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmDataEntry",,,"[YourControl] = " & "'" &[ListBox] & "'""
"YourContro l" would be the name of the matching control on frmDataEntry
"ListBox" would be the name of the listbox you are double clicking on.
Jan 30 '09 #2
Quizzed
33 New Member
Don,
tks for the quick reply.Im now receiving a syntax error on the following code;

DoCmd.OpenForm "frmDataEnt ry", , , "[frmDataEntry.tx tRepairRef] = " & "'" & [lstEnquiry] & "'"""

To try and resolve I've tried it without the the form name eg;
DoCmd.OpenForm "frmDataEnt ry", , , "[txtRepairRef] = " & "'" & [lstEnquiry] & "'"""

I also tried replacing the form name and field with the table name and field.

Im going wrong somewhere
Appreciate any advice.
Jan 30 '09 #3
DonRayner
489 Recognized Expert Contributor
@Quizzed
It should be like this.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "frmDataEntry", , , "[txtRepairRef] = " & "'" & [lstEnquiry] & "'""
And it looks like you have an extra " at the end

First set of quotes is " ' "
Second set of quotes is " ' " "

Let me know how it works.
Jan 30 '09 #4
Quizzed
33 New Member
Still receive the syntax error.
When i move away from the code, there is an additional " applied as the last character - Is this whats causing the syntax error and if so is there any way of stopping this?
Jan 30 '09 #5
DonRayner
489 Recognized Expert Contributor
Ok Try this instead

Expand|Select|Wrap|Line Numbers
  1. Dim strCondition as string
  2. strCondition = "[txtRepairRef] = " & """" & me.lstEnquiry & """"
  3. DoCmd.OpenForm "frmDataEntry", , , strCondition
  4.  
]
Jan 30 '09 #6
Quizzed
33 New Member
It now prompts me to enter the value for the field txtRepairRef

If i then enter a value which i know exists, it does then open the form but without any of the associated data from the underlying table.
Jan 30 '09 #7
DonRayner
489 Recognized Expert Contributor
Put the following line before the DoCmd line. and let me know what shows up in the message box.

Expand|Select|Wrap|Line Numbers
  1. msgbox strCondition
Jan 30 '09 #8
Quizzed
33 New Member
I selected repair ref 999998 and when i dclick this now returns;
[lstEnquiry].[txtRepairRef]='999998' With an OK cmd button.

If i then select OK, it returns lstEnquiry.txtR epairRef and needs me to input a value.
Jan 30 '09 #9
DonRayner
489 Recognized Expert Contributor
Your mesbox should be showing

Expand|Select|Wrap|Line Numbers
  1. [txtRepairRef]='999998'
Please post back the exact code that you are using.
Jan 30 '09 #10

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

Similar topics

14
5419
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
12
3386
by: Mike MacSween | last post by:
Sorry if this is a bit off topic, but I can't seem to find a 'remote control' newsgroup on my news server. And anyway I know Tony has some experience of this. The app is split FE/BE. I'd like remote access to at least the server, hopefully the whole network. And to be able to upload/download, to install new versions of the FE to the server (which then get sent up to the clients at runtime). What experience does anybody have of this....
49
14354
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
20
3347
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to speed. I like books with practical exercises, and also with test questions (like cert books) *2*
7
3056
by: Stephen Poley | last post by:
I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus optional extra textual information (e.g. "left early due to illness"). The solution I had in mind was: 1) create a presence table, keyed on employee-id and session-id, containing a 'present' yes/no field and a comment text field; 2) cross-join...
4
12441
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
1
1480
by: luvkling | last post by:
hi, i am new to asp.net. i currently doin a website. i created a add form in this form the user need to add in the record n when they press the submit button it will add the record into the access database "dvd_rental" in the respective table in actor, director, movie. in the form for the actor n director there is a dropdown list for user to choose, if the actor or director is not in the dropdown list they need to key in the name. May i noe wat...
2
19491
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.