Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2003, 04:28 AM
Authorized User
 
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to search for (and select) a record?

Hi,

i'm having a few tables in access...now i want to create some forms. On such a form i want an editbox where i can fill in a serial number. WHen pressed enter i want all the details from that product are being showed in the form.. How do u a thing like this within ms access.

i also have a second question...i've already made an other form (actually somebody else made it but asked me to fix it). With that form u can't insert new records to the db...I couldn't find a read-only setting or property...is there some setting which determines if u can insert records or not?

Greetz,

Harold
 
Old June 30th, 2003, 07:38 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to MRvLuijpen Send a message via MSN to MRvLuijpen
Default

Hello Harold,

With the following code it is possible to find some data in table querys etc:

Private Sub editbox_Change()
    Dim strSQL As String, Code As String
    Dim rcd As New ADODB.Recordset
    Dim cn As ADODB.Connection

    Set cn = CurrentProject.Connection

    strSQL = "SELECT tbl.detail1, tbl.detail2 FROM tbl WHERE tbl.serial = '" & Me.serial & "'"
    rcd.Open strSQL, cn
    If Not rcd.EOF Then
        Me.txtdetail1 = rcd!detail1
        Me.txtdetail2 = rcd!detail2
    End If
End Sub


Hope this helps.

Marc
 
Old June 30th, 2003, 06:50 PM
Authorized User
 
Join Date: Jun 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Harold,

To answer your second question, go to design view of the form, click on properties button and check that AllowAdditions property is set to Yes. If it is set to No, the form will not accept new records.

Vlad

Vladimir Rakic
System development planner
Production Control M407/1
Heavy Maintenance
Qantas Airways Limited





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to select the particular record? azymd777 ASP.NET 2.0 Professional 1 August 8th, 2008 05:55 AM
Search and match record from two tabel delion Pro VB Databases 1 May 15th, 2007 11:51 AM
Search for a record using a form a_wahab Access 6 September 1st, 2006 12:03 PM
code to search a record Rudner VB Databases Basics 1 November 17th, 2004 11:52 PM
search select control rajanikrishna HTML Code Clinic 2 March 3rd, 2004 11:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.