Link to home
Start Free TrialLog in
Avatar of Zac123
Zac123Flag for United Kingdom of Great Britain and Northern Ireland

asked on

access 2007 populate memo box with data from another table

hi all,

i thought i knew how to do this but it seems not... ive tried messing around with the default value to make this work but no cigar as yet.

i'd like the memo text area on my for to be pre-populated for the user when they open up a new form with data from another table. however the user is then free to make  changes to that data and then click save which saves to the other table.

if the user decides to open the data they just saved then they should see the edited version of textarea data and not 'default' data

i hope of explained that ok.

as always, all help apprecited.

zac
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zac123

ASKER

ok i'm using this:

Private Sub Form_frmNewQA_Current()
    If Me.NewRecord = True Then
           Me.QATerms = DLookup("QATermsDefault", "QA_Defaults")
    End If
End Sub
the "QA_Defaults" bit is the name of the tble right?

nothing seems to happen. note how i added the name of the form in the private sub line (frmNewQA) is that correct?

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(You shouldn't rename the current event)
Avatar of Zac123

ASKER

ok got ya.

if i use this:

Private Sub Form_Current()
    If Me.NewRecord = True Then
           Me.QATerms = DLookup("QATermsDefault", "tblQA_Defaults")
    End If
End Sub

i get:

 User generated image
Avatar of Zac123

ASKER

oh wait!!!

how many on current event can i have?

i already have onee:

Private Sub Form_Current()
If Me![Check11] = 1 Then
Me![QASubjectTo1].Visible = True
Me![Check14].Visible = True
Else
Me![QASubjectTo1].Visible = False
Me![Check14].Visible = False
Me![QASubjectTo2].Visible = False
Me![Check17].Visible = False
Me![QASubjectTo3].Visible = False
Me![Check20].Visible = False
Me![QASubjectTo4].Visible = False
Me![Check23].Visible = False
Me![QASubjectTo5].Visible = False
End If
End Sub
Okay - I think that means that you have a duplicate Current Event now (that confuses Access).

Remove the initial attempt

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zac123

ASKER

see post above

is there a way round this?
We're crossing posts...

You need to add the code I gave you to your existing Current Event code.  Place it at the beginning.
Avatar of Zac123

ASKER

yey i think we're gettin there. it only seems to appear when i click on the new form button and not when the form is first opened. i guess i could just add the same code under the on load event?

ok, now to work on your second bit of code your gave me.
I thought the idea was to ONLY do this for new records.

If you want to load this everytime the form opens, just take out the new record check.

In other words, reduce this:

    If Me.NewRecord = True Then
           Me.QATerms = DLookup("QATermsDefault", "tblQA_Defaults")
    End If

Open in new window



To this:

 
          Me.QATerms = DLookup("QATermsDefault", "tblQA_Defaults")

Open in new window


(Keeping it in the Current Event)
Avatar of Zac123

ASKER

NOPE SORRY SCRAP THAT

i was getting my self mixed up, i had blank records saved in the table, i was just generally getting confused.

its all working thanks for your excellent help.

Glad to help :-)