remember memo field entry to new account

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

win xp and access 2003.
I create a block of text on form called "NoteBuilderFrm".
When I click a command button, it transfers the text from "NoteBuilderFrm"
to a memo field [item-note] on another form "receiveinventoryquickfrm". I
then want to be able to proceed on "receiveinventoryquickfrm" to a new record
and for it to automatically carry the data posted into [item-note] to the
next record from the last record. Here is the code I have now, but it isn't
'remembering' the data posted from the other form. If I type in my own data,
it works fine, but I can't do that every time. What am I doing wrong?

'code to post the data from the notebuilderfrm
Private Sub Command14_Click()
Forms!receiveinventoryquickfrm!itemNote = Me.Text8
DoCmd.Close
DoCmd.GoToControl "itemNote"
End Sub

'code to copy notes from last record to the new record
Private Sub itemNote_AfterUpdate()
Me!itemNote.DefaultValue = """" & Me!itemNote & """"
End Sub
 
BLTibbs said:
win xp and access 2003.
I create a block of text on form called "NoteBuilderFrm".
When I click a command button, it transfers the text from "NoteBuilderFrm"
to a memo field [item-note] on another form "receiveinventoryquickfrm". I
then want to be able to proceed on "receiveinventoryquickfrm" to a new record
and for it to automatically carry the data posted into [item-note] to the
next record from the last record. Here is the code I have now, but it isn't
'remembering' the data posted from the other form. If I type in my own data,
it works fine, but I can't do that every time. What am I doing wrong?

'code to post the data from the notebuilderfrm
Private Sub Command14_Click()
Forms!receiveinventoryquickfrm!itemNote = Me.Text8
DoCmd.Close
DoCmd.GoToControl "itemNote"
End Sub

'code to copy notes from last record to the new record
Private Sub itemNote_AfterUpdate()
Me!itemNote.DefaultValue = """" & Me!itemNote & """"
End Sub


Ahhhh, Maybe I figured out the issue here. When you use VBA
to assign a value to a text box, it's events are not
triggered so the AfterUpdate never gets executed.

You can assign the default value in your button's procedure:

Private Sub Command14_Click()
With Forms!receiveinventoryquickfrm
!itemNote = Me.Text8
!itemNote.DefaultValue = """" & Me!Text8 & """"
!itemNote.SetFocus
End With
DoCmd.Close acForm, Me.Name, acSaveNo
EndSub

Or, you can call the AfterUpdate procedure to assign the
default (my recommended method):

Private Sub Command14_Click()
With Forms!receiveinventoryquickfrm
!itemNote = Me.Text8
Call Forms!receiveinventoryquickfrm.itemNote_AfterUpdate()
!itemNote.SetFocus
End With
DoCmd.Close acForm, Me.Name, acSaveNo
EndSub

Or, you can set the the itemNote text box's Text property,
which will trigger its events:

Private Sub Command14_Click()
With Forms!receiveinventoryquickfrm
!itemNote.SetFocus
!itemNote.Text = Me.Text8
End With
DoCmd.Close acForm, Me.Name, acSaveNo
EndSub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top