Updating subform autonumber on enter

julz142

New member
Local time
Today, 19:40
Joined
Apr 26, 2020
Messages
5
Hi all,

I'm new to the Access world and to this site, so please forgive my lack of knowledge.

I currently have a form 'Project Data Entry' in which one enters project data - this form automatically generates a ProjectID.

The 'Project Data Entry' form includes a subform 'Tender Projects Data Entry' which consists of only a TenderProjectID (it's PK), and ProjectID (a FK relating to Projects) which is linked to the ProjectID in 'Project Data Entry'.

When I create a new Project in 'Project Data Entry', the ProjectID is automatically generated, and it appears in the 'Tender Projects Data Entry' subform. My problem is, once I enter this subform, I can't actually add anything to the Tender Projects table, since it doesn't automatically generate a TenderProjectID. Is there a way I can update the autonumber TenderProjectID so this subform creates a new entry and adds it to it's table?

Sorry if that was confusing, I can explain further if needed. Thanks.
 
Hi. Welcome to AWF ! Sounds like there's something off with the setup between the main and subform. Can you post a sample db?
 
Thanks! Here's a sample db which illustrates the problem. In the Project Data Entry form, when a ProjectName is added, it generates a ProjectID and adds this to the Tender Projects Data Entry subform. When entering the subform, it's not possible to actually add the record since it doesn't generate a TenderProjectID.
 

Attachments

you add another field to it like on thw subform's table, like tenderDate, TenderDetail, Status, etc.
having only 2 fields? whats the purpose of that table? then give meaning to it. its supposed to record something, right?
 
Is there a way to do it without adding another field? In the larger db this subform is only used to contain another subform which uses the generated TenderProjectID.
 
In the larger db this subform is only used to contain another subform which uses the generated TenderProjectID.
Your design does not make any sense. What are you trying to do?
 
Your design does not make any sense. What are you trying to do?

Here is an example which hopefully better illustrates what I'm trying to do. This might not be the best way of doing things but is the only way I could think of (don't forget I'm new to this).

As you can see when accessing the subform within 'Tender Projects Data Entry', the linked TenderProjectsID field isn't filled in since this wasn't updated in the subform.
 

Attachments

Here is an example which hopefully better illustrates what I'm trying to do. This might not be the best way of doing things but is the only way I could think of (don't forget I'm new to this).

As you can see when accessing the subform within 'Tender Projects Data Entry', the linked TenderProjectsID field isn't filled in since this wasn't updated in the subform.
Hi. Since you have a one-to-many relationship between projects and tender projects, you'll have to "select" the tender project for your project. So, I think your form setup is a bit off. In the subform for tender projects, you should have a combobox to select a tender project.
 
Hi. Since you have a one-to-many relationship between projects and tender projects, you'll have to "select" the tender project for your project. So, I think your form setup is a bit off. In the subform for tender projects, you should have a combobox to select a tender project.

I see what you mean, it should be a one-to-one relationship though, not sure if I forgot to implement that in the example.

The reason I want this number to be generated automatically is so that I can go straight into the inner-most subform without having to generate the TenderProjectID first. Hope that makes sense.
 
I see what you mean, it should be a one-to-one relationship though, not sure if I forgot to implement that in the example.

The reason I want this number to be generated automatically is so that I can go straight into the inner-most subform without having to generate the TenderProjectID first. Hope that makes sense.
If it's a 1to1, then why even need a separate table?
 
check the code on the Main form.
add new project in main form, then click anywhere in the subform or its subsubform.
 

Attachments

Users who are viewing this thread

Back
Top Bottom