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

ADODC by date problem

15
I am trying to move through records in a table using the ADODC tool. But I want to move through those records that occur on a specigic date, a date that was selected on a calandar using another form.

I was using the following code and I cannot get it to work.

Any Ideas?

Thank You in advance.


RecordSource = SELECT * FROM tblLog WHERE EventDate = #Forms!EditEntryByDate!calLog#
Dec 26 '07 #1
6 1464
Dököll
2,364 Expert 2GB
I am trying to move through records in a table using the ADODC tool. But I want to move through those records that occur on a specigic date, a date that was selected on a calandar using another form.

I was using the following code and I cannot get it to work.

Any Ideas?

Thank You in advance.


RecordSource = SELECT * FROM tblLog WHERE EventDate = #Forms!EditEntryByDate!calLog#
Hello, opie!

I got just the thing. I urge you to search through the pages under adodc1...If it means looking through specific records, I can show you how to do this in DAO or you can look it up yourself here:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim myDatabase As Database
  3. Dim myRecord As Recordset
  4. Set myDatabase = OpenDatabase("C:\DataMining\Data_Central.mdb")
  5. Set myRecord = myDatabase.OpenRecordset("SELECT * FROM YourTable WHERE UserID='" & Text1(0).Text & "'")
  6.  
  7.  
You can turn UserID into the date field to search for specific date.

Please look for that post for added support. Adodc1 helps you page through the data... I thought to have read ADO is not that far off, you also fetch results here or Google on it; perhaps something of a difference between the two is posted.

Good luck:-)

Dököll
Dec 26 '07 #2
opie
15
I have looked through the post several times. I cannot get this to work after about a week of working at it off and on.

It work fine when I insert the the exact date as the recordSource as shown below.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tblLog WHERE EventDate = #12/7/2007#
But when I try to refer it to a form that is still in memory (I have not unloaded the form) it gives me a syntax error. Now I am using MS Access Syntax so maybe that is the problem, but in this instance I figured it would be the same and I am unable to find the proper syntax.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tblLog WHERE EventDate = #forms!EditEntryByDate!calLog#
Dec 27 '07 #3
daniel aristidou
491 256MB
If your getting a data type error or the wrong records.
Try using
The CDate This converts the the record feild and criteria into the same date format.
Expand|Select|Wrap|Line Numbers
  1. WHERE Cdate(EventDate) = cdate(forms!EditEntryByDate!calLog)
Ps im not too sure about the " ' " that are needed.
i usually just use trial error.
When i first got this problem took me ages to find solution :)

Hope this helps you......... if not it may others.

Holiday Greetings
Daniel
Dec 27 '07 #4
Dököll
2,364 Expert 2GB
I have looked through the post several times. I cannot get this to work after about a week of working at it off and on.

It work fine when I insert the the exact date as the recordSource as shown below.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tblLog WHERE EventDate = #12/7/2007#
But when I try to refer it to a form that is still in memory (I have not unloaded the form) it gives me a syntax error. Now I am using MS Access Syntax so maybe that is the problem, but in this instance I figured it would be the same and I am unable to find the proper syntax.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tblLog WHERE EventDate = #forms!EditEntryByDate!calLog#
Bummer, let's try to muscle through it then togheter, how's that for a deal?

Are you saying you did not find the post mentioned?

If you click on my handle and go through, has to be further in the pages, I'll race ya:-)

I am having look by the way because I must fire my notebook to get a real look...

Also there are bits of information you can use from others that have posted.
I'll attempt to type it up an try it.

In a bit!
Dec 28 '07 #5
Dököll
2,364 Expert 2GB
Beat ya:-)

Alright, this is one of two links, my apologies I thought I had it all in one post...

I must fetch another old post:-)

http://www.thescripts.com/forum/thre...65-adodc1.html


Got it. I decided to just strip it for spare parts, it is a rather large post...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAdd_Click()  
  2.  
  3.         Dim my_database As Database 
  4.  
  5.         Set my_database = OpenDatabase("C:\Yoda1.mdb")
  6.  
  7.         my_database.Execute "insert into Yoda1.Yoda(UserID, Name, Address, Phone, Email) Values('" & Text1.Text & "','" & Text2.Text & "' , '" & Text3.Text & "' , '" & Text4.Text & "','" & Text5.Text & "')"
  8.         my_database.Close ' 
  9.  
  10. Text1.Text="" 
  11. Text2.Text="" 
  12. Text3.Text="" 
  13. Text4.Text="" 
  14. Text5.Text="" 
  15.  
  16. End Sub
  17.  
You'll need to reference DAO 3.6, I think.

So if you have a date field in your access database, you should be able to load into VB using this code.

Try it, and good luck:-)
Dec 28 '07 #6
Dököll
2,364 Expert 2GB
Beat ya:-)

Alright, this is one of two links, my apologies I thought I had it all in one post...

I must fetch another old post:-)

http://www.thescripts.com/forum/thre...65-adodc1.html


Got it. I decided to just strip it for spare parts, it is a rather large post...

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAdd_Click()  
  2.  
  3.         Dim my_database As Database 
  4.  
  5.         Set my_database = OpenDatabase("C:\Yoda1.mdb")
  6.  
  7.         my_database.Execute "insert into Yoda1.Yoda(UserID, Name, Address, Phone, Email) Values('" & Text1.Text & "','" & Text2.Text & "' , '" & Text3.Text & "' , '" & Text4.Text & "','" & Text5.Text & "')"
  8.         my_database.Close ' 
  9.  
  10. Text1.Text="" 
  11. Text2.Text="" 
  12. Text3.Text="" 
  13. Text4.Text="" 
  14. Text5.Text="" 
  15.  
  16. End Sub
  17.  
You'll need to reference DAO 3.6, I think.

So if you have a date field in your access database, you should be able to load into VB using this code.

Try it, and good luck:-)
Sorry wrong code, you need SELECT FROM, I have been doing this lately, fogetting stuff:-)

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'this is searching for existing data in your access
  3.  
  4. Private Sub Seek_Click() 'this is your button
  5. Dim my_database As Database           'dimension database as database 
  6. Dim my_record As Recordset              'dimension recordset as recordset
  7.  
  8. Set my_database = OpenDatabase("C:\DataMining\Yoda.mdb")  
  9.  
  10. 'You can change above path/folder name to location of your own access 
  11. 'database
  12.  
  13. 'Going forward, above function will open your database 
  14. 'Make sure your databse is closed
  15.  
  16. Set my_record = my_database.OpenRecordset("select * from Yodamania where UserID like '" & Text1.Text & "'")    ' this is used to search by user id
  17.  
  18.    Do While Not my_record.EOF  
  19.  
  20. 'this function will keep searching for fields matching each textbox
  21.  
  22.         Text1.Text = my_record.Fields("UserID")
  23.         Text2.Text = my_record.Fields("Name")
  24.         Text3.Text = my_record.Fields("Address")
  25.         Text4.Text = my_record.Fields("Phone")
  26.         Text5.Text = my_record.Fields("Email")
  27.  
  28.  my_record.MoveNext 
  29.    Loop
  30.    my_database.Close
  31. End Sub
  32.  
  33.  
Remember to use DAO, you will get an error without a reference; I am sure you know that, just saying it before I forget:-)

Also, rest assure your adodc1 control will work just fine with DAO...

In a bit!
Dec 28 '07 #7

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

Similar topics

0
by: Meher Malakapalli | last post by:
Hi I have an application built in VB6. It uses an adodc control bound to several other controls. After installing the .NET framework, the application's data-bound controls no longer display the...
4
by: Raoul Watson | last post by:
I have a form with an AdoDc control associated to a datagrid. The AdoDC uses a "ConnectionString" such as "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=..." this is...
1
by: Ariane | last post by:
I have an ADODC object in my form which populates a datagrid. I set the coonection string for ADODC at design time. The problem is that I have no way to close the connection when i exit the...
1
by: blobi | last post by:
i tried to use adodc with unknown recordsource but it couldn't work when i was using datagrid with adodc as datasource. "ADO can not set for the command text". why i failed for using adodc with...
2
by: techie2 | last post by:
Can you help me to handle the error with ADODC? When I run any form which has ADODC on it I get an 'Operation was cancelled' or 'Could not find installable isam' errors. How to eliminate these...
1
by: yosh29rs | last post by:
I have been using Adodc recently to link my system in vb6 to my detabase until our professor required us recently to use SQL which is completely new to me and ive never encountered before. How is it...
2
by: yosh29rs | last post by:
I have been using Adodc recently to link my system in vb6 to my detabase until our professor required us recently to use SQL which is completely new to me and ive never encountered before. How is it...
3
by: yosh29rs | last post by:
I have been using Adodc recently to link my system in vb6 to my detabase until our professor required us recently to use SQL which is completely new to me and ive never encountered before. How is it...
1
by: hussainiyad | last post by:
Dear all, i,m new to v.b and i tried to connect to sqlserver through adodc in a datagrid or datalist , but there was no result in my form, can any one tell me what's the reason and i done every...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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...

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.