How to search records for nth record from a particular record

I have a query containing a date field and other fields/details. On the form I have a date field and need to know what the date is in the table 60 record after the date entered. The query date field will always remain in the same order but contains random
dates which may be 20/03/15, 21/03/15 then the next could be 28/03/15. What I want to do is enter a date into the form such as 22/03/15 and be able to populate a second field on the form with a date that is 60 records after 20/03/15. I've tried several ways
but just can't seem to work it out. Any ideas would be appreciated

the help so far has been fantastic, all works fine and now I just want to tidy it up a bit. What I am trying to do is put a date into a form textbox and have it work out 60 (which I've changed to 10 to check a bit easier) working days (no weekends and
no public holidays) and populate a second text box with the date.
I've set up two tables, one with 10 years of sequential dates and one with holiday. I then have a query to give me just the work days, which it does. This is the query code: (Named qryOfferExpiryDte)
SELECT tbldates.AllDteIDS, tbldates.AllDte, Weekday([AllDte]) AS WeekDayNo
FROM tbldates LEFT JOIN tblHolidays ON tbldates.AllDte = tblHolidays.HolidayDte
WHERE (((Weekday([AllDte]))<>7 And (Weekday([AllDte]))<>1) AND ((tblHolidays.HolidayDte) Is Null));
The code I have done so far to make it work is:
Private Sub Command0_Click()
Dim OfferDte As Date
Dim InitCount As Integer
Dim TotalCount As Integer
OfferDte = txtOfferDte
InitCount = DCOUNT("*", "qryOfferExpiryDte", "AllDte  <=  #" & Format(OfferDte, "yyyy-mm-dd") & "#")
TotalCount = 10 + InitCount
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT * FROM qryOfferExpiryDte ORDER BY AllDte"
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.Move TotalCount
'Debug.Print rst.Fields(0).Name & " = " & rst.Fields(0).Value
Me.txtExpiryDte = rst.Fields(1).Value
End If
rst.Close
Set rst = Nothing
Set dbs = Nothing
End Sub
To tidy it up I'd like to remove the query (qryOfferExpiryDte) from the dbase and just have it as code. I've tried changing it to:
  Dim strSQlA As String
  strSQLA = "SELECT tbldates.AllDteIDS" & vbCrLf
  strSQLA = strSQLA & "           , tbldates.AllDte" & vbCrLf
  strSQLA = strSQLA & "           , Weekday([AllDte]) AS WeekDayNo" & vbCrLf
  strSQLA = strSQLA & "        FROM tbldates " & vbCrLf
  strSQLA = strSQLA & "   LEFT JOIN tblHolidays " & vbCrLf
  strSQLA = strSQLA & "          ON tbldates.AllDte = tblHolidays.HolidayDte" & vbCrLf
  strSQLA = strSQLA & "       WHERE (((Weekday([AllDte]))<>7 " & vbCrLf
  strSQLA = strSQLA & "         AND (Weekday([AllDte]))<>1) " & vbCrLf
  strSQLA = strSQLA & "         AND ((tblHolidays.HolidayDte) Is Null));"
and replacing the reference to the query with strSQLA but I just can't get it to work. I keep getting an error saying "Microsoft Jet cannot find the table/query strSQLA.
Any ideas appreciated.

Similar Messages

  • How to search records in a standard table with * ?

    Hi everyone,
    Can anyone tell me how to search records in a standard table with * ?
    That is, in screen if user type * abc * for searching the records in which the field MC_STEXT contains 'abc'. What the code should be? How to complete the code below?
      SELECT SINGLE objid FROM p1000  INTO p1000-objid,
      WHERE MC_STEXT = ? .
    Thanks!

    Hi
    There are several way to do that, probably just as some guys wrote the easier way is to use LIKE in WHERE condition and the sign % instead of *:
    V_STRING = '%ABC%'.
    SELECT SINGLE objid FROM p1000 INTO p1000-objid,
    WHERE MC_STEXT LIKE V_STRING.
    U can also use a range (just like select-options):
    RANGES: R_MC FOR P1000-MC_STEXT.
    R_MC-LOW = 'ABC'.
    R_MC(3) = 'ICP'.
    APPEND R_MC.
    SELECT SINGLE objid FROM p1000 INTO p1000-objid,
    WHERE MC_STEXT IN R_MC.
    Max

  • How to search records using netbeans

    i'm using netbeans.....how to search records from database
    pls help me

    Not at all....i'm familar with java,i stucking in button coding,that is
    how to match with database.
    public String buttonGo_action() throws SQLException {
    // TODO: Process the action. Return value is a navigation
    // case name where null will return to the same page.
    System.out.println("Action******");
    String sname=(String) textsearch.getText();
    sname = "%"+ sname+"%";
    grc_risks_customer_info_tableDataProvider.setCursorRow(grc_risks_customer_info_tableDataProvider.findFirst("NAME",sname));
    //.findFirst("GRC_RISKS_CUSTOMER_INFO_TABLE",sname));
    getSessionBean1().getGrc_risks_customer_info_tableRowSet().setString(1,sname);
    grc_risks_customer_info_tableDataProvider.refresh();
    this coding is not working...that's y...

  • How to schedule Job for data uploading from source to BI

    Hi to all,
    How to schedule Job for data uploading from source to BI,
    Why we required and how we do it.
    As I am fresher in BI, I need to know from bottom.
    Regards
    Pavneet Rana

    Hi.
    You can create [process chain |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502b2998-1017-2d10-1c8a-a57a35d52bc8?quicklink=index&overridelayout=true]for data loading pocess and schedule start process to any time/date etc ...
    Regadrs.

  • How to design EDW for source systems from different Time-Zones

    How to design EDW for source systems from different Time-Zones?
    Suppose IT landscape has a global BW in New York, and source systems in americas, europe and asia, then how the time-zones effect on time related things like delta selections on date or timestamp etc.

    As you said BW is global in NY, your source system must be global too. People from various locations can connect to same source system and thus timestamps for delta is always maintained as 1 single time. We have same scenario in our project. Our R/3 system is used by users in US and Europe. So we run deltas twice in day to make sure we got deltas from both locations.
    If scenarios was such that all locations connect to separate R/3 system, then obviously you have multiple queues. That is unique delta queue for each source system so deltas will be pulled as per data in respective queues.
    Abhijit

  • How to erase emails for iPhone 5s from computer

    how to erase emails for iPhone 5s from computer

    Go to the website for the email account.
    Delete the emails in question.
    Most email accounts will update the other assocaited devices immediately.  If yours doesn't, it might be a POP account.

  • How to search OER for method signatures

    I would like to search OER for Service assets that have a specific input and/or output. I'm sure this is easy to do but am missing something.
    I was reading the description in the Sample Interface - Account Detail Interface shipped with OER and it says....
    "Users may search for particular method signatures, find this asset, and from here discover the services that implement this interface."
    That's what I want to do but am not sure how to do it. Can anyone explain how I would go about doing that?

    Try a simple search, put the method name in the search box, select the type as All Type. The search will list down the Interface and the Service that contains the api.

  • Search Help for Company Code from Backend

    Hi experts,
    How can I make a SH for company code from backend system? I already made a SH for account assigments from backend with USAGE_SH_F4  functioanality, but i don't know whether I can use it for Company code or not? And how?
    Best Regards,
    Mikhail.

    I need functionality where I will manually maintain backend system, and then I need bind search help for this backend system with my input field for web dynpro. For Account Assignment I use this: http://scn.sap.com/community/srm/blog/2014/01/08/standard-account-assignment-search-helps-in-custom-srm-developments
    But what should I use for company code?

  • How to fetch data for a struture from a cluster table

    How can I fetch data for a struture, from a cluster table, based on the name of the structure?

    Hi,
    In order to read from Cluster DB Table use the following statement:
    Syntax
    IMPORT <f1> [ TO  < g1 > ] <f2> [TO < g2 >] ...
    FROM DATABASE <dbtab>(<ar>)
    [CLIENT <cli>] ID <key>|MAJOR-ID <maid> [MINOR-ID <miid>].
    This statement reads the data objects specified in the list from a cluster in the database <dbtab>.
    You must declare <dbtab> using a TABLES statement. If you do not use the TO <gi> option, the
    data object <fi> in the database is assigned to the data object in the program with the same
    name. If you do use the option, the data object <fi> is read from the database into the field <gi>.
    For <ar>, enter the two-character area ID for the cluster in the database. The name <key>
    identifies the data in the database. Its maximum length depends on the length of the name field
    in <dbtab>.
    The CLIENT <cli> option allows you to disable the automatic client handling of a client-specific cluster database, and specify the client yourself. The addition must always come directly after the name of the database.
    For Eg:
    PROGRAM SAPMZTS3.
    TABLES INDX.
    DATA: BEGIN OF JTAB OCCURS 100,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF JTAB.
    IMPORT ITAB TO JTAB FROM DATABASE INDX(HK) ID 'Table'.
    WRITE: / 'AEDAT:', INDX-AEDAT,
    / 'USERA:', INDX-USERA,
    / 'PGMID:', INDX-PGMID.
    SKIP.
    WRITE 'JTAB:'.
    LOOP AT JTAB FROM 1 TO 5.
    WRITE: / JTAB-COL1, JTAB-COL2.
    ENDLOOP.
    Regards,
    Neha
    Edited by: Neha Shukla on Mar 12, 2009 1:35 PM

  • How to bind values for input parameters from an adf table?

    Hi,
    The version I am using is
    Jdev TP4 11.1.1.0.0
    I need to know how to bind values for input parameters to methods.
    I have created an af:table and I have a button created using a method which is outside the af:table. This method needs to take input parameter values from the column values in the table.
    When I have an adf form instead of the table the binding works.
    Any help?
    Thanks.

    Hi Balaji,
    you need to bind you table to a backing bean and call a method in the backing bean when you hit the button. In the method you get the selected row from the table and have access to the columns of it. Then call the the method with the parameters.
    To bind the table to a bean select the properties of the table, go to behavior section and look for the advanced section 'Binding' property.
    Select the small down arrow at the right side and click edit. In the dialog select or create a bean and property for the table.
    Go to the button properties, look for 'Action', again select the small down arrow and click 'Edit'. Select the bean which holds the table property and create a method for the button.
    The method look like    public void bearbeitenQuelle(ActionEvent actionEvent)
            // Add event code here...
            RichTable lTable = getYourTable();
            Object lData = lTable.getSelectedRowData();
            FacesCtrlHierNodeBinding lNB = (FacesCtrlHierNodeBinding) lData;
            YourViewRow lRow = (YourViewRow ) lNB.getCurrentRow();
        }Hope the get you started
    Timo

  • How to search and delete an email from the mailbox

    hi,
    have a hybrid scenario, exchange 2013 and office 365
    what command should I use to search and delete an email from the organization mailbox i.e. I do not want that email to be in any users inbox.
    I have tried this command but it does not work, it says search-mailbox is not recognized as the name of the command let.
    Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"Download this file"' -DeleteContent
    kindly assist.
    Kind Regards, Khuzema R.

    Hi Khuzema
    This can be accomplished by search-mailbox command
    First you need to create a new role group
    To Create –  New-RoleGroup “Mailbox Import-Export Management” -Roles “Mailbox Import Export”
    Then add the user to the group
    To Add user – Add-RoleGroupMember “Mailbox Import-Export Management” -Member Administrator
    Search the mailbox
    get-mailbox -ResultSize unlimited -IgnoreDefaultScope | search-mailbox -SearchQuery ‘Subject:”virus infected”’ -LogOnly -TargetMailbox administrator -TargetFolder filter -LogLevel Full
    Now we need to run the below command to search the infected emails and delete all of them in the whole organization
    get-mailbox -ResultSize unlimited -IgnoreDefaultScope | search-mailbox -SearchQuery ‘Subject:”virus infected”’ -TargetMailbox administrator -TargetFolder filter -deletecontent -LogLevel Full
    Also you can do a message tracking with the subject and delete them
    Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} | Get-MessageTrackingLog -Messagesubject “Virus Infected” | Select-Object Timestamp,ServerHostname,ClientHostname,Source,EventId,Recipients
    | Sort-Object -Property Timestamp
    I have written a blog with regards to the same. You can always refer this which might mostly  help you in your scenario
    http://exchangequery.com/2014/10/16/steps-to-delete-circulated-suspicious-emails-with-search-mailbox/
    Thanks 
    Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com Thanks Sathish
    (MVP)

  • How can I pay for my purchases from itunes/App store in indian currency in India?, How can I pay for my purchases from itunes/App store in indian currency in India?, How can I pay for my purchases from itunes/App store in indian currency in India?

    I have an iphone4 and am resident of India.  As per current foreign regulations, I am not permitted to mane payment in US$ for my purchases from ITunes/App Store.  Every time I sign in I am asked to give details of my credit card.  I have a debit card for my indian currency Account.  Can I give this card number in the required field and if so, will any debit contravene Indian foreign exchange regulations?

    Create an Account Without a Credit Card:
    http://support.apple.com/kb/HT2534
    Apple ID FAQ
    http://support.apple.com/kb/HE37

  • How can I track all email sent from one particular user through powershell?

    Went online and found a few commands like:
    Get-MessageTrackingLog -Server servername -Start "11/17/2014 09:00:00" -End "11/17/2014 17:00:00" -Sender "user@domain"
    Got back:
    Get-MessageTrackingLog : The term 'Get-MessageTrackingLog' is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At line:1 char:1
    + Get-MessageTrackingLog -Server Mail2013 -Start "11/17/2014 09:00:00" -End "11/17 ...
    + ~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Get-MessageTrackingLog:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    ALL I WANT TO DO IS TO TRACK EMAIL SENT FROM A PARTICULAR USER: Delivery reports in the EAC came up with absolutely nothing after entering the user mailbox and user
    Any help would be appreciated - RJM

    try this :
    get-messagetrackinglog -Server mail01 –resultsize unlimited
     -Start "11/17/2014 09:00:00" -End "11/17/2014 17:00:00" -Sender "user@domain"| Select-Object eventid,sender,timestamp,@{Name="Recipients";Expression={$_.recipients}},@{Name="RecipientStatus";Expression={$_.recipientstatus}},messagesubject
    | Export-CSV c;\tracking.csv
    Then import file to excel
    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

  • How to See logs for custom programs from without the logviewer in NWA

    Hello Experts,
    The JavaAS developers want to see the logs for their custom programs from without the logviewer in NWA.
    Do you have any experience or know of any reference materials to instruct them on where to write their logs, and how to configure NWA to see them?
    Thanks
    Jibin.

    Hello Jibin,
    Your developers should familiarize themselves with the Logging Framework of the J2EE Engine.
    Here is the guide:
    http://help.sap.com/saphelp_nw04/helpdata/EN/a2/15ab41d60bcb46e10000000a155106/frameset.htm
    If they use the Logging Framework you would be able to access the logs through NWA.
    Regards,
    Ventsi Tsachev
    Technology Development Support (J2EE Engine)
    SAP Labs, Palo Alto, Ca (USA)

  • How to get support for research work from oracle?

    sir
    i want to undergo a research from a univ at my city on db security and cryptography.i may require some document and psudo code of certain algorithim.how to get those from oracle?
    regards

    Find a contact within Oracle to help get you introduced to the Product Manager(s) for the area of interest. Ways to find that contact:
    - Oracle Sales (ask your/university sales rep for an intro)
    - relevant Oracle Forums (watch for responses from Oracle employees)
    - Oracle Wiki
    - Oracle Open World where you can meet lots of employees
    - User group meetings

Maybe you are looking for

  • Multi-language support for Contacts

    I live in Beijing and store addresses for my Contacts in English and Chinese. Prior to IOS 7, I was able to display these address on my iPhone in both languages. The addresses still appear in English and Chinese on my MBP and in iCloud. However, I on

  • ITunes not opening and ideas?

    I have just bought a 2nd Gen iPod Touch when I connect it to my macbook pro iTunes does not open nothing opens, when I connect my old iPod touch it opens iTunes automatically any ideas guys?

  • Change AR invoice due date

    I have a transaction that  a user accidentally posted with a doc date and due date of 2007.  I don't care about the docdate so much, but I need to update the due date to be 2009.  What table(s) and fields do I need to update in sql to do this?  I nee

  • Combine the concat value in a single textfield.

    hi there, How to make the concat function, combining the multiple textfield into a single textfield It doesnt work when i'm inserting the data in the last of textfield.It should appear when i have finished inserting the data.. should i put the onChan

  • Linking to msoffice files

    Hi everyone.... I created a main page in Fireworks. I have used drop down lists and all. Now I export everything to Dreamweaver. I click on F12 and the page opens and everything is fine. One of the choices offereb by the drop down list is to go to a