User Profile

Collapse

Profile Sidebar

Collapse
shankindc
shankindc
Last Activity: Feb 22 '07, 08:03 PM
Joined: Feb 12 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • shankindc
    replied to "Insert into" creating issues
    My error cannot be done an error trap as it isnt a runtime error (which has a debug/End button) but system error which says duplicate records cannot be inserted.

    The one thats frustrating is this "ADD Record" functionality in a form. it updates an old existing record rather than inserting it, when I modify an existing record entry in a form... I'm going to start over this project from scratch to find an alternative. Thanks...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to "Insert into" creating issues
    The logic might work. But thats not my issue in the first place.

    If you look at my first thread/post, the suggestion you gave for the second issue is what am trying to do on a form_before update function. But each time I Insert the new record, it gives a PK violation error but inserts the record into the table w/o any issue. I did not have any issues with updating existing records. Hence if I can somehow override the Access form _onClose...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to "Insert into" creating issues
    DCount() = 0 OR DCount() = 0 will not help because it can never be true since I can and will have multiple entries of each key in the table.

    Idea behind editing existing fields (and not scrolling to a new record) in the form is bcos a lot of the fields are repetitive over a period of time and so that users need not type all the information from scratch.

    Thanks...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to "Insert into" creating issues
    I dont think I could use DCount = 0 AND DCount = 0 as I had explained earlier, there can be multiple occurences of the key fields independently, in my table. But as a composite key, there could be only one instance in my table.

    eg: Name Date
    John 01/22/07
    Peter 01/22/07
    John 02/10/08

    In this case, if I try to enter a new row say, Peter ...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to "Insert into" creating issues
    ---------------------------------------------------------------------------------------------------

    I think I had the logic incorrect in my previous post. If the DCOUNT is > 0, it shouldnt insert a row.
    That aside, I cannot use DCOUNT here because my primary Key is a composite key and hence DCOUNT of each of the keys can definitely be > 0, but the composite key count has to be = 0 for me to insert a new row.
    ...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to "Insert into" creating issues
    Hi,
    I'm sorry. I had posted only a snapshot of my code. That extra End if was part of an If stmt I had not enclosed in my post. Flag was also initialized earlier. No issues with those.

    I tried DCOUNT as follows, based on if a user presses "Yes" button in a popup screen

    Code:
    If lResponse = vbYes Then
      Cancel = False
      If DCount("ResourceName", "tblProject", "ResourceName
    ...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to Access date functionality
    Thanks. Did try that out. Can you pls help me with the thread "Insert into" creating issues?...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to Access date functionality
    Wow! didnt know we could manipulate Weekday function this way.. Thanks for the explanation....
    See more | Go to post

    Leave a comment:


  • shankindc
    started a topic "Insert into" creating issues

    "Insert into" creating issues

    Hi,
    I have a data entry form which opens default values each time the form is open. Requirement is that users can edit existing data in the form. When the form is closed, it shouldnt update the existing record but rather insert a new record.

    On the Form-Beforeupdate function, I first check if the record already exists (Primary keys exist). Then I wrote a "Insert into" SQL that picks all values from the form and inserts...
    See more | Go to post

  • shankindc
    replied to Access date functionality
    Hi NeoPa,
    Thanks for your reply. It works fine. Just curious about how the logic works in your case. I understand that Weekday(Date()) returns a number from 1-7 and date add adds a particular # of days to the current date.

    In your suggestion, it says
    DateAdd("d",7-Weekday(Date(), 7),Date())

    Weekday(Date(), 7) - does this take the smaller of the two parameters Weekday(Date() and the value 7? And...
    See more | Go to post

    Leave a comment:


  • shankindc
    replied to Access date functionality
    Thanks so much for the quick response. A question on your logic.

    //myDate = DateAdd("d", 2, myDate) ' Adds two days to account for the fact that it might be Saturday.

    When I did some research, i found that Saturday has a weekday value of 7. I presume your logic works on the assumption that Saturday has a value 0? or maybe my understanding is incorrect? And is there a specific reason you chose the range 2 to...
    See more | Go to post

    Leave a comment:


  • shankindc
    started a topic Access date functionality

    Access date functionality

    Hi,
    I have the following requirements

    In a form, there exists a date field which needs to be automatically populated. The date has to be the Friday of every week. Assume in a calendar week Feb 4th - Feb 11th, if the user opens a form for data entry anytime between Feb 4th(Sunday) - Feb 9th (Friday), the data field should populate with Feb 9th date. If the user opens the form anytime after Feb 9th, the date field should populate...
    See more | Go to post
No activity results to display
Show More
Working...