Text box to cell, not bound

macattack

Registered User.
Local time
Today, 14:43
Joined
Jan 5, 2013
Messages
35
Hi,

Scoured the internet and these forums and I'm unable to find what I'm looking for. I have a memo cell in a table that I'd like users to be able to insert their name into (from the same form). Basically allowing a user to throw their name into the memo, then auto-clear the box. When they enter their name a date will automatically be added.

Obviously if it's bound it will update but then it can't be cleared, and it doesn't paste this to the bottom of my memo, it tries to place it as the first few characters of my memo.

Any help will be greatly appreciated!

mac
 
The Code you could use would look something like;
Code:
If Not IsNull(Me.YourTextField) or Me.YourTextField <> "" "Then [COLOR="DarkGreen"] 'Check if text box is empty[/COLOR]
     Me.YourMemoField = Me.YourMemoField &  Chr(10) & Chr(13) & Me.YourTextField & " " & Date()   [COLOR="DarkGreen"] 'Use Now() if you require a time stamp[/COLOR]
     Me.YourTextField = ""   [COLOR="DarkGreen"]'Clear text box[/COLOR]
End If

This code will append the name (typed into the text box) along with the current date after a carriage return and a line feed, then clear the text box. You will need to decide which event to use to trigger this code.
 
Perhaps I should have mentioned I'm a complete novice with Access/VB. I began working on this 3 days ago, never touched it beforehand but I am a quick study. I tried pasting it into the text box's on Exit section but it did not like having nothing after the "Then so I deleted the quotation and it stopped erroring, but doesn't update.

Also, why do people put "me."?
 
What you will need to do is; first decide the event that you wish to trigger the code. Having made that decision, select Event Procedure for the list, and click the ellipsis button (that's the little square button with three full stops on it to the right)

attachment.php


This will open up the code window, paste your (appropriately modified) code into the area I've highlight;

attachment.php


You will probably find that when you do this you will just see the heading Private Sub (name of your chosen event) followed by End Sub, rather than all the stuff in my image.
 

Attachments

  • Capture.JPG
    Capture.JPG
    41.7 KB · Views: 166
  • Capture2.JPG
    Capture2.JPG
    48.9 KB · Views: 170
Ok, thanks for you help, got this 99% done. Last thing is it refuses to accept new lines (it'll be awesome when I can actually post pictures).

When I enter a name in the text box and hit enter it places their name and date in the table, yay! The issue is the two are on the same line. I tried every iteration of "& vbCrLF & vbNewLine &" and "& Chr(10) & Chr(13) &" I could find online and am having no luck.

What "Memo" should look like:

blah blah blah blah
macattack
1/8/2013

The event is on Exit
Me.Memo = Me.Memo & Me.User & Date
needs to be: ^new line ^new line

Thanks again!
 
The field is formatted as a Memo field (at table level) isn't it?
 
Yes. And I just realized this site doesn't like extra spaces haha, so ignore where I tried to put them in at the bottom, it should look like:


blah blah blah blah
macattack
1/8/2013
 
Can you post a copy of your DB, and I'll take a look and try and figure out what going on.
 
The form is called ATU1 and the "Add User" button will be removed (I initially thought I needed it but enter, tab, or just clicking outside the text box works just as well).

Oh, another thing, I was experimenting with everything I could think of so there's an "Lf" in there right now that definitely doesn't need to be there.
 

Attachments

I don't have Access '10 here, so I'll take a look this evening, when I get a chance.
 
I finally found in the help file it appears '10 uses "adCRLF" "adCR" and "adLF" but everything I try with any combo still fails.
 
That completely confused me. I thought you were indicating that you had got things sorted so didn't bother looking at your DB :banghead: will have a look this evening.
 

Users who are viewing this thread

Back
Top Bottom