Subforms & Limiting Record Entry

epicmove

Ben
Local time
Today, 17:28
Joined
Apr 21, 2006
Messages
59
Hi guys,

What would be the best control source to use for my sub forms detailed below:

I am designing an Asset Management System. Each the main Asset Table "TblAssetMain" has child tables "TblAssetType", "TblAssetDetails", "TblAssetEventLog".

When a new asset is created, the AssetMain form will have subforms for these three child tables (linked by Asset_ID = Subform![Asset_ID]).

Can I use a query of the child tables for data entry or, if I set the control source to the actual tables, can I limit the number of records in the child tables for each record in the Asset Main table to "1".

Basically each Asset will have one record in AssetMain and 1 relating record in each of the child tables i.e. you cant have more than one AssetDetail record for one Asset.

Did do a search and found the following code but not sure whether there is a way without using code?

Code:
Code:
Private sub Form_BeforeInsert(Cancel as Integer)
If Me.txtCount > 2 Then
    Cancel = True
    Me.Undo
    Msgbox "Please return a book before checking out a new one", vbOKOnly
End If
End Sub
 
Have a look at the attached sample;
 
Last edited:
Limiting Number Of Record Entries

Thanks,

Should be able to get what I need from this.

Dont really want a message box displayed, just need to show the user only one blank record to enter data into (on continuous forms).

Presume I can add the me.form.allowadditions = false to run after a record has been entered. The user will then only have the option to edit that record.

How do I disable the user from using tab (on single form views) to go to a new record? Would I use a similar approach to the above?

Thanks

Ben
 
Dont really want a message box displayed,
Remove it from the code.

Presume I can add the me.form.allowadditions = false to run after a record has been entered. The user will then only have the option to edit that record.
Did you read all the code? Have a look under;
Private Sub PartNumber_AfterUpdate()

How do I disable the user from using tab (on single form views) to go to a new record? Would I use a similar approach to the above?

What do you mean by tab?
How do they enter data if they can't go to a new record?
 

Users who are viewing this thread

Back
Top Bottom