Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add records to subform

Status
Not open for further replies.

Parkroyal

Technical User
Jan 15, 2004
45
0
0
GB
I have a subform runing from a table linked to the main form by a customer ID field. This subform is also linked to a query.

The subform displays orders that are related to the customer ID on the main form. This works well. However I cannot enter a new record onto the subform.

I used to be able to do this but I'm not sure when this situation changed as I have been developing other parts of my db and ignored this untill last night when I was running tests.

The subform and the main form opens in add mode and both forms have data input enabled.

Any ideas?
 
Make sure that the underlying recordset for your subform is actually editable. Can you edit records that have already been entered?

Eric
 
Hi Eric

negative can't edit anymore niether
 
Look at your recordsource (the table or query) that your subform is based on. If there is a join between two tables then there can only be one possible record for the related fields in both tables. See if you can get rid of one of the tables.

HTH,
Eric
 
Thanks

Ahh that there be might be the prob.

I'll go and investigate and come back.

cheers
pete
 
No still not sorted

It dosn't appear to be a problem caused by a join in the tables or queries.

I can edit or add to the table directly and the bassic order will show on the sub form so that side is ok.
But the add new record option is greyed out on the subform.

When a new order is generated (added to the table) another form becomes available to add details to the order. If I manually add a record to the table then I can add the details but without adding a record manually this is imposible.

I coppied an example that I found in Access template 'orders' for this part of my db to enable people to generate orders against a client ID and it worked fine untill recently.

My hair is now 2 shades greyer than itwas last night!

Thanks

Pete
 
If you want you can send me a desensitized copy and I will take a look at it.

Eric
eisom@esc11.net
 
OK thanks

I'll have to make a copy and empty the tables so i'tll take me a little while

Pete
 
try setting your recordset type in the subform to
'Dynaset (Inconsistent Updates)'.
 
Thanks anch

tried that but it don't make no difference

Pete
 
Eric my e-mail is not geting to you for some reason anyone else got any ideas?
 
Why not use VB to add the information to the subform's underlying table(s) and then do a requery to get it visble to the user. VB is not that tough and is so powerful it ought not be neglected. Send and ask for a sample if you wish.

rollie@bwsys.net
 
Ok I'll try owt once email on it's way

Thanks Pete
 
Pete, I only made two changes.

First, I created a function to get the total Payments so I could remove the link to the TotalPayments query.

Second, I removed the sum from your line total calculation.

I did change the data entry property to yes so I could see the results. I had to remove two references so the function would compile.

HTH,
Eric
 
Pete,

It's off to you. I added a cmd button and a textbox

and this code:

Private Sub cmdADDR_Click()
Dim rs As DAO.Recordset, savr As Long, BM As Variant

If IsNull(Me.txtItem) Then Exit Sub

savr = Me.MID
BM = Me.Bookmark

Set rs = CurrentDb.OpenRecordset("STable")

rs.AddNew
rs("MID") = savr
rs("Item1") = Me.txtItem
rs.Update
rs.Close
Set rs = Nothing
Me.Requery
Me.Bookmark = BM
Me.txtItem = Null

Exit Sub

Rollie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top