Form and linked subform

DevAccess

Registered User.
Local time
Today, 03:41
Joined
Jun 27, 2016
Messages
321
Hello,

I have below situation.

I have one form and one subform and on main form i have combo box wherein I can select any existing record and subform populates based on existing data.

Now I have to create a new record in order to accomplish that I have created add button on main form and will create a new record for user to enter using acnewrecord.

Now in order to create a new record I have to proivde combobox where in user can select existing record and they can create other data for that for example one user can have many same data, like one vendor can have multile other vendor list so they have to enter the data for each sub vendor.

so when I am selecting existing vendor data the subforms get fills up automatically..

this is wrong when I am creating a new sub vendor data for the master vendor it should allow me to create new data with all fields are blank.

So the conclusion is when I want to add new record for existing vendor i should be able to enter all the data but since subform is linked with vendor id on form it is populating subform and i am making their value on combobox's after update event it says this is required field and gives me error.



can anybody please help me on this.
 
Are you linking the main and sub form using the "Link Master Fields" and "Link Child Fields" property?
Is the sub form's property "Allow Addition" set to "Yes"?
Else post your database with some sample data, zip it + description on how to reproduce the problem.
 
Are you linking the main and sub form using the "Link Master Fields" and "Link Child Fields" property?
Is the sub form's property "Allow Addition" set to "Yes"?
Else post your database with some sample data, zip it + description on how to reproduce the problem.

Yes both are true and set like that only.. my concern is when I want to add new record and when I select existing I'd it is populating rest of subform fields while I want to enter new data for existing I'd.
 
What does a new record have to do with an existing record? Do you want to add a new record and start off by defaulting the non key values to some previous record? If that's the case you are going to have to change the behavior of the combo box for the case of a new record. Maybe in the afterupdate of the combo you would have something like:

Code:
If Me.NewRecord then
    'Create recordsetclone
    'Find record selected in combo
    'copy fields to form fields
Else
   'existing code
End If

Is that what you want?
 
What does a new record have to do with an existing record? Do you want to add a new record and start off by defaulting the non key values to some previous record? If that's the case you are going to have to change the behavior of the combo box for the case of a new record. Maybe in the afterupdate of the combo you would have something like:

Code:
If Me.NewRecord then
    'Create recordsetclone
    'Find record selected in combo
    'copy fields to form fields
Else
   'existing code
End If

Is that what you want?

When I want to create a new record all the subform fields should be blank but since subform is linked with master form it and when I am selecting vendor from main form combobox it fills the subform fields with existing record.
 
I just isn't clear what you are trying to accomplish. Please give us a specific example, step by step of what you want to occur when you add a new record. It might help if we could see what you have so far. Please upload the database or a stripped down copy of it.
 

Users who are viewing this thread

Back
Top Bottom