Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 January 19th, 2008, 03:09 PM
Registered User
 
Join Date: Jul 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sparsh2010
Default New Bie- Select Statement problem

I am trying to develop a "computer allocation to employee" system

I have a database table name = Asset ( all the field name are defined as text)
Table name = Asset

Cubical_No ( desc- something like seat number)
Name ( name of the employee)
Email_ID ( mail id of emoloyee)
Extension ( phone number or extension of employee)
Asset_ID ( computer name )
IP_Address1 ( ip address of computer )
IP_Address1 ( ip address of computer - if two computer are kept at same work station)

and I have a Form which will display the one record from database on screen while pressing NEXT or PREVIOUS button

 I am Trying to do following

1. Query the first record from table name = Asset
2. Show it on the form , Detail for Form given below
FORM NAME = Form1
FIELDS
    cubetxt
    nametxt
    mailtxt
    assetidtxt
    extensiontxt
    ip1txt
    ip2txt

And i wrote query given below

Private Sub Next_Click()
    Dim NextSQL As String
    DoCmd.SetWarnings False

    NextSQL = "SELECT [Asset].[Cubical_No]" & _
                   " FROM [Asset] " & _
                   "WHERE (([Asset].[Cubical_No]) > (cubetxt.Value));"

    DoCmd.RunSQL NextSQL
    MsgBox "Record query"
    DoCmd.SetWarnings True
End Sub

I know this is wrong but can anybody help me doing the two things as mentioned above , i dont want to go for cmdGetRecordset and open a saved query , i need to write a qery in form only

Pramod Chandra
 
Old January 22nd, 2008, 01:00 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

This table structure needs to be normalized into 3 tables (Employee, Asset, Asset_Employee.)

The statement you wrote would return ALL records greater than the one you are currently on.

Why don't you use the button wizard and put in the next and previous record buttons? Is there a reason you only want one record at a time in your form? You will need to assign NextSQL to the Record Source of the form: Me.RecordSource = NextSQL, etc. You will need to reopen the form to do this, I think.

Can you post more info?

mmcdonal

Look it up at: http://wrox.books24x7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with SELECT INTO statement 132591 SQL Language 1 November 27th, 2006 06:58 AM
SQL select statement problem shrisangeeta Classic ASP Databases 3 June 15th, 2006 10:28 AM
Problem with "where = " select statement shirley65 SQL Language 3 October 17th, 2005 04:07 PM
Problem with select statement s.abraham ASP.NET 1.0 and 1.1 Basics 2 March 24th, 2005 02:29 PM
SELECT statement...strange problem abbylee26 Classic ASP Databases 7 March 16th, 2004 02:34 PM





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