473,441 Members | 3,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

reteriving data from a table

59
its seems like the most simple question on access...

anyway, I have a table with reservations and I want to loop through it (with code..) and check which reservation is at a specific date.
from that ofcurse I want to get the name of the persone who made that reservation.

I hope someone could help me out.. and I'm sorry if I'm asking obvious questions...



sigh.. why is it so hard to find help in tutorials about it ?
Aug 30 '07 #1
5 1276
ADezii
8,834 Expert 8TB
its seems like the most simple question on access...

anyway, I have a table with reservations and I want to loop through it (with code..) and check which reservation is at a specific date.
from that ofcurse I want to get the name of the persone who made that reservation.

I hope someone could help me out.. and I'm sorry if I'm asking obvious questions...



sigh.. why is it so hard to find help in tutorials about it ?
ASSUMPTIONS:
  1. Your Table Name is tblReservations consisting of the following Fields:
    1. Date - [DATE/TIME]
    2. First - [TEXT]
    3. Last - [TEXT]
  2. The SQL would be:
    Expand|Select|Wrap|Line Numbers
    1. SELECT Date, First, Last
    2. FROM tblReservations
    3. WHERE tblReservations.Date=[Enter Reservation Date (MM/DD/YYYY)];
Aug 30 '07 #2
zivon
59
well... I know SQL.. but it doesn't work on VBA...
I already tried that..
looks like VBA doesn't recognaiz SELECT as a valid command..
Aug 31 '07 #3
zivon
59
ok, thanks, I mannaged to do the query... but now I have another weird problam..

when I try:

SELECT CustomerName, CkInDate from Orders WHERE Orders.CustomerName='Idan'"

it works with no problams.. but when I'm trying a date, it doesn't work..
I tried this both:

1) SELECT CustomerName, CkInDate from Orders WHERE Orders.CkInDate='31/08/2007'"

this gives me an error..

2)
CkDate = "31/08/2008"
SELECT CustomerName, CkInDate from Orders WHERE Orders.CkInDate=" & CkDate

this one doesn't give an error, but it doesn't find any record... and I checked milion times, there is a recored CkInDate equal to 31/08/2008
Aug 31 '07 #4
zivon
59
btw, to help others who are trying the same thing:


Function GOR(d As String) As String

Dim db As Database
Dim Lrs As DAO.Recordset
Dim LSQL As String
Dim GOrder As String

'Open connection to current Access database
Set db = CurrentDb()

'Create SQL statement to retrieve value from GST table
Dim CkDate As Date
CkDate = "22/08/2008"
LSQL = "select CustomerName, CkInDate from orders WHERE orders.CkInDate=" & CkDate

Set Lrs = db.OpenRecordset(LSQL)

'Retrieve value if data is found
GOrder = "Not Found"
Do While Lrs.EOF = False
GOrder = Lrs("CkInDate")
' GOrder = Lrs("CustomerName")
Lrs.MoveNext
Loop

Lrs.Close
Set Lrs = Nothing
GOR = GOrder
End Function
Aug 31 '07 #5
Scott Price
1,384 Expert 1GB
ok, thanks, I mannaged to do the query... but now I have another weird problam..

when I try:

SELECT CustomerName, CkInDate from Orders WHERE Orders.CustomerName='Idan'"

it works with no problams.. but when I'm trying a date, it doesn't work..
I tried this both:

1) SELECT CustomerName, CkInDate from Orders WHERE Orders.CkInDate='31/08/2007'"

this gives me an error..

2)
CkDate = "31/08/2008"
SELECT CustomerName, CkInDate from Orders WHERE Orders.CkInDate=" & CkDate

this one doesn't give an error, but it doesn't find any record... and I checked milion times, there is a recored CkInDate equal to 31/08/2008

Date literals must be enclosed in # signs. #31/03/2008#

Regards,
Scott
Aug 31 '07 #6

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

Similar topics

2
by: ben moretti | last post by:
hi i'm learning python, and one area i'd use it for is data management in scientific computing. in the case i've tried i want to reformat a data file from a normalised list to a matrix with some...
5
by: Alexandre | last post by:
Hi, Im a newb to dev and python... my first sefl assigned mission was to read a pickled file containing a list with DB like data and convert this to MySQL... So i wrote my first module which...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
5
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
3
by: kpmassey | last post by:
I'm using javascript to construct large tables from an array of data, using ideas from: http://www.oreillynet.com/pub/a/javascript/2003/05/06/dannygoodman.html The data itself cannot be...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
13
by: farhaaad | last post by:
Dears, I have many feilds in my tables that are left blank for some records, If I make a sub table for it and and change those feilds to a lookup feilds so only those options are chosen which...
5
by: Troels Arvin | last post by:
Hello, Every so often, I'm asked to help people recover data from tables that were either dropped or where to much data was DELETEed. The complications related to restoring data are a problem....
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
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...
1
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,...
0
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.