add new record form,subform

laz

New member
Local time
Today, 03:42
Joined
Mar 14, 2008
Messages
3
Hi Guys!

I have a form connected to a table and have a subform connected to a different table. The subform is unbound so there is no connection with main form whatsoever (just a little combobox what's filtering the subform's source)

When I'm trying to add a new record I'm able to save everything on the form but not on the subform. What's the best way to save the subform's data to the new record.

I've tried playing with recordset and was able to save everything, but had an extra row created because of the

docmd.gotorecord , , acNewRec


any suggestion
 
I'm a bit confused when you say that the subform is "connected to a different table" but the "subform is unbound." How are records related to each other and what is the function of the subform? What works best for me is to have all forms unbound and then write code to save records to whatever tables I have and then link the forms with code.
 
What I was trying to say is the subform is unbound but there is a combo box on the form and depend on what the user pick from the list, the subform's recordsource will be set.

The problem the subform's table and the mainForm's table has no connection so I can't set up master/child connection, without that I have to use recordset to save the subform. When using "DoCmd.GoToRecord , , acNewRec" it will save the main form but not the subform.


Right know I use DoCmd.GoToRecord , , acNewRec to open a new record, then use recordset to add the subform's data.

It would be ok if I wouldn't have problem to find the last record what I just opened. For some reason I can't use Top 1 or Limit 1 in the SQL statement maybe because of the linked tables.


So what I have to do is open a new record, then open another record with recordset and save the user input, once everyhting is done I just delete the extra record.
 

Users who are viewing this thread

Back
Top Bottom