textbox on form to table on subform (1 Viewer)

SeanDelere

Registered User.
Local time
Today, 08:16
Joined
Sep 7, 2004
Messages
51
Hello again All,

Thanks to everyone in the Querys forum (particularly Ken) I now have a form using code to calculate my next product code.

The form has a subform which in turn is based on a query. The query gets it criteria from list boxes on the main form and displays just the top 1 record which is the last product code used.

Is there a way of writing the next product code into the table on the subform on the next line? I can do it manually by clicking the new record button on the subform then copying and pasting into it. I thought a macro would be able to do it but macros don't seem to work as they do in Excel where you can record a sequence of key stokes.
I also tried using the "default data" property but didn't get very far.

As usual, any suggestions most welcome.
 

KeithWilliams

Registered User.
Local time
Today, 08:16
Joined
Feb 9, 2004
Messages
137
Hi,

Try:
Me.Recordset.MoveLast
Me.Recordset.Edit
Me.Recordset.Value = NextProductCode
Me.Recordset.Update

Keith.
 

SeanDelere

Registered User.
Local time
Today, 08:16
Joined
Sep 7, 2004
Messages
51
Thanks Keith - I'll give it a try.
 

SeanDelere

Registered User.
Local time
Today, 08:16
Joined
Sep 7, 2004
Messages
51
I am having trouble with the line

Me.Recordset.Value = NextProductCode

It doesn't seem to matter what I put after the equals sign I always get this error when it runs.

Runtime Error 438
Object doesn't support this property or method

If I delete this line the code runs OK but obviously doesn't do anything

Any ideas?
 

SeanDelere

Registered User.
Local time
Today, 08:16
Joined
Sep 7, 2004
Messages
51
Think I've got it half sorted now.

Changed it to Me.Recordset.ProductCode.Value = NextProductCode
 

Users who are viewing this thread

Top Bottom