473,699 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I change the following code?

98 New Member
Hi everybody, I want to retrieve the details from the database by the date from (MM/DD/YYYY) to (MM/DD/YYYY). For that I have to change the following code as follows
Expand|Select|Wrap|Line Numbers
  1. rs.Open "select * from Table where empid='" & Text1.Text & "'", con
So kindly anyone reply me.
Feb 2 '07 #1
11 1620
Killer42
8,435 Recognized Expert Expert
Hi everybody, I want to retrieve the details from the database by the date from (MM/DD/YYYY) to (MM/DD/YYYY). For that I have to change the following code as follows
rs.Open "select * from Table where empid='" & Text1.Text & "'", con
Do you need to do this instead of the empid, or the two together? Here are some ideas...
  • Just the date range
    Expand|Select|Wrap|Line Numbers
    1. rs.Open "select * from Table where DateField Between #" & _
    2.         strStartDate & "# AND #" & strEndDate & "#", con
  • Both
    Expand|Select|Wrap|Line Numbers
    1. rs.Open "select * from Table where empid = '" & Text1.Text & _
    2.         "' AND DateField Between #" & strStartDate & "# AND #" & _
    3.         strEndDate & "#", con
I'm assuming here that your dates are in string variables, already formatted as MM/DD/YYYY.
Feb 2 '07 #2
willakawill
1,646 Top Contributor
And you are assuming it is an Access database
Feb 2 '07 #3
Killer42
8,435 Recognized Expert Expert
And you are assuming it is an Access database
Guilty.

I do tend to think in terms of VB6 and Access, and if people aren't specific, I figure they'll just have to make do with what they get. :)
Feb 2 '07 #4
sreekandan
98 New Member
Do you need to do this instead of the empid, or the two together? Here are some ideas...
  • Just the date range
    Expand|Select|Wrap|Line Numbers
    1. rs.Open "select * from Table where DateField Between #" & _
    2.         strStartDate & "# AND #" & strEndDate & "#", con
  • Both
    Expand|Select|Wrap|Line Numbers
    1. rs.Open "select * from Table where empid = '" & Text1.Text & _
    2.         "' AND DateField Between #" & strStartDate & "# AND #" & _
    3.         strEndDate & "#", con
I'm assuming here that your dates are in string variables, already formatted as MM/DD/YYYY.
I tried with that codigs.But run time error has occured as "Too few parameters required".So kindly give me the suggestion for that.
Feb 5 '07 #5
sukeshchand
88 New Member
i thing there is no error in the above query

replace the code with this one
Expand|Select|Wrap|Line Numbers
  1. rs.Open "select * from Table where empid = '" & Text1.Text & _
  2.         "' AND DateField Between #" & strStartDate & "# AND #" & _
  3.         strEndDate & "#", con,adOpenForwardOnly ,adLockReadOnly
Feb 5 '07 #6
sreekandan
98 New Member
i thing there is no error in the above query

replace the code with this one
Expand|Select|Wrap|Line Numbers
  1. rs.Open "select * from Table where empid = '" & Text1.Text & _
  2.         "' AND DateField Between #" & strStartDate & "# AND #" & _
  3.         strEndDate & "#", con,adOpenForwardOnly ,adLockReadOnly
I used two text boxes to get the date from the MonthView control.
So i have written the code is
Expand|Select|Wrap|Line Numbers
  1. rs.Open "select * from tbl where empid = '" & Text1.Text & "' AND DateField Between #" & Text2.Text & "# AND #" & Text3.Text & "#", con, adOpenForwardOnly, adLockReadOnly
Eventhough the same error has occured.So kindly reply me
Feb 5 '07 #7
Killer42
8,435 Recognized Expert Expert
It may be that you have not adjusted our field names to match your own. For example, I used the name DateField because I don't know what yours is called. If your field name is not DateField then you will need to change this.

If that's not the problem, we'll have to investigate further.

Note, if you're going to post an error message, make sure you copy it precisely. I suspect that "Too few parameters required" is not quite the wording Access used (though as always, I could be wrong).
Feb 5 '07 #8
sreekandan
98 New Member
It may be that you have not adjusted our field names to match your own. For example, I used the name DateField because I don't know what yours is called. If your field name is not DateField then you will need to change this.

If that's not the problem, we'll have to investigate further.

Note, if you're going to post an error message, make sure you copy it precisely. I suspect that "Too few parameters required" is not quite the wording Access used (though as always, I could be wrong).

I have written the following code to retrieve and display the details into the ListView control.
Expand|Select|Wrap|Line Numbers
  1. rs3.Open "select * from tbl where empid = '" & Text1.Text & "' AND dat Between #" & Text2.Text & "# AND #" & Text3.Text & "#", con, adOpenForwardOnly, adLockReadOnly
  2. rs.MoveFirst
  3. Do Until rs.EOF
  4.    j = j + 1
  5.    lv.ListItems.Add j, , j
  6.    lv.ListItems(j).SubItems(1) = rs!empid
  7.    lv.ListItems(j).SubItems(2) = rs1!firstname & rs1!lastname
  8.    lv.ListItems(j).SubItems(3) = rs3!dat
  9.    lv.ListItems(j).SubItems(4) = rs3!intime
  10.    lv.ListItems(j).SubItems(5) = rs3!outtime   
  11.    rs.MoveNext
  12. Loop
But I couldnt retrieve all the details from the database table.
I could retrieve only the same data repeatedly until the EOF.For that how can I retrieve the full details from the table.So kindly reply me
Feb 6 '07 #9
willakawill
1,646 Top Contributor
When you are posting code please use code tags. Clearly you are highlighting your code and clicking on the center justify and bold buttons. Please don't do that. Click on the '#' button instead. This is the third time I have added code tags to your posts
Thanks
Feb 6 '07 #10

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

Similar topics

4
2628
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family commitments. But it has to be done soon so this is stage one. Mike Winter provided an extensive list of...
13
6090
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which during production. Usually, this only wraps code used to control quitting the whole app versus just shutting a form, but it can also control many other things. However, as part of the build before delivering an update, I have to remember to...
4
15513
by: pjac | last post by:
I need some help with some VB language that will change the screen resolution on a monitor when a MS-Access 2000 database is opened from 1024 x 768 to 800 x 600. Any help with this effort would be deeply appreciated. Thanks in advance....
2
4694
by: Smith Duggan | last post by:
I am attempting to change the background properties of a rectangle in the code, and have been stuck now for a day and a half. This is my first access app. Please be gentle with my steaming pile of code: If I include the following in a subroutine, the rectangle properties will change just fine for a rectangle with the name of "Pos4Box": Me!Pos4Box.BackColor = 8421504 I have nine rectangles Pos1Box - Pos9Box and have a variable...
8
8497
by: lauren quantrell | last post by:
Is there a way to force a change in a user's screen resolution using VBA code without having any input from the user? Example: User John Backwards has his screen set to 800 x 600 pixels. Backwards loads an Access app that needs at least 1024 x 768 pixels so the app, on load, changes the screen resolution for him to 1024 x 768.
10
9873
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
6
3329
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this? Also, If the user change the text in the textbox then how do I refesh the display in the datagrid to reflect the changes? ...
2
8531
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control in .net(forms application) by chnging one trckbar(like tb1->Value),
3
5009
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change data in the text boxes. Then an "update" button saves the data back to the database. What is the best way to change several properties on most of the textbox controls on the form when the "modify" button is clicked? (e.g. make them editible (and...
7
1914
by: Martin Pritchard | last post by:
Hi, Sorry for my ignorance, but I'm a bit new to C++. I've been handed over a C++ app written in VS2002 which I have to convert to VS2005. Apparently it's been written in a C style, but cannot comment myself! Following the conversion I have numerous errors, which following some digging around turns out to be because _export is obsolete, and
0
9197
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
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
8941
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,...
0
8897
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6549
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
4390
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3071
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
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.