Results 1 to 12 of 12
  1. #1
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39

    "You cant create new record"

    Good Morning.
    I have developed a rental database. Every machine has a main form and a subform for rental details. Now what I want to do is that in subform if the machine is not returned (ie. field value is returned), then new record in the same subform for same machine would not be permitted, for example a message box "You Cannot Create new record".

    Is it possible?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Something along those lines may be what you are after, however I do not know the data types of your fields so it is just a guess! Provide more details as to field data types and primary key,etc...

    If Me.Returned = False And ID = ID And Me.[NewRecord] = True Then
    MsgBox " You Cannot Create a new Record"
    Me.Undo
    Exit Sub
    End If

  3. #3
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39
    Here is the db. It will be cleared now that "when on subform field name [maintenance status] is empty (null) then new record underneath that would not be created".

    Feel free to ask details.
    Attached Files Attached Files

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Here is what I think you are after

    If not, let me know!
    Attached Files Attached Files

  5. #5
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39
    I am not very good with VB. But let me give you a clue.

    if (me.maintstauts <> "return") then
    me.newrecord = false
    else
    me.newrecord = true
    end if

    I want something like this
    Actually nullity of [maintstatus] field means that the machine is still on rent and cant be rented to any other site. It must be filled to make further transactions.
    I hope you get my point

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    So what I did will not work for you? Then I don't know what you want since it did accomplish the purpose. You want something else? Describe in detail if that is the case.

  7. #7
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39
    You reached too close but I think there was a mistake in my explaination. Now I attached a Snapshot with a little explaination I hope it would work.
    Attached Thumbnails Attached Thumbnails DB Snap.png  

  8. #8
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    You got what you asked for. You can't create a record when NO MaintStatus IsNull. If you hit F5 or refresh you can edit/change the first record and then when it has data you can then add data to the next record, which is what you asked for. If it is not , then I don't think I can help you. I spent a considerable amount of time on this. Try what I asked and see if it will work for you, if not, then I must bow out and maybe someone else may be able to help you that better understands what you want. first record is available, but not the next one until you enter all of the data, then do a refresh and then second record will be available and so on.

  9. #9
    digitalbalu is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Location
    India
    Posts
    14
    Its better You re design your forms with slight changes. Separate New Machine Entry and its rental. Use a combo box to select a machine. In the combo box control source use the query which shows only the available Machines. I will re design your form .

  10. #10
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Then I bow out and you can take over. I don't co-design for anyone.

    Good Luck With Your Project.

  11. #11
    digitalbalu is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Location
    India
    Posts
    14
    Before that plz answer for my understanding.

    If the returned date is some xx/xx/xx and maintenance status is returned then the machine is ready for rent. Am I correct?

  12. #12
    digitalbalu is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Location
    India
    Posts
    14
    Quote Originally Posted by burrina View Post
    Then I bow out and you can take over. I don't co-design for anyone.

    Good Luck With Your Project.
    Oh! burrina. I am extremly sorry. All the above reply is for abusaif not for you. I forget to mention his name. Still I am a novice.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Replies: 4
    Last Post: 04-26-2012, 08:25 PM
  4. Replies: 11
    Last Post: 03-29-2012, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums