Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 11th, 2005, 11:57 AM
boysherman boysherman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 5 boysherman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 3 sec
Reputation Power: 0
append query and variables from a memo field

Hi,

I have string data from a memo field in a form that is parsed some of the data is stored in variables when a button is clicked. These values are not saved, and do not appear in any of the fields in the form. How do I reference and use these variables in an append query?

Thanks for your help,

Bill

Reply With Quote
  #2  
Old July 11th, 2005, 02:21 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
The following example will parse the first word from a memo field named Text and will append to Table1 field AppendedText behind a command button

Dim strSQL As String
strSQL = "INSERT INTO Table1 ( AppendedText )" & _
"SELECT Left(Text, InStr(1, Text, "" "") - 1) AS BOGUS;"
DoCmd.RunSQL strSQL

You can also assign the value of an unbound textbox with your string parsing and use the unbound textbox in your append query as the field and run the query directly while the form is open....or

You can create a recordset of the table and use the .Add & .Update methods of the recordset

Was this what you were looking for???

lwells

Reply With Quote
  #3  
Old July 11th, 2005, 02:36 PM
boysherman boysherman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 5 boysherman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 3 sec
Reputation Power: 0
variables from a memo field and append query

Thanks! This is getting close. This is what I have:


varTitle = Mid(varPasteString, varBeginTitle, varEndTitle - varBeginTitle)

varItemID = Mid(varPasteString, varBeginItemID,

varCallNumber = Mid(varPasteString, varEndItemID, 25)

Now I would like to use the values stored in these variables in an append query.

The paste field from which these values are retrieved is a bound field on a form. My sub goes through and retrieves the values above. How do I reference them so that I can use these variables in a query? Is this possible?

Thanks for your help,

bill



Quote:
Originally Posted by lwells
The following example will parse the first word from a memo field named Text and will append to Table1 field AppendedText behind a command button

Dim strSQL As String
strSQL = "INSERT INTO Table1 ( AppendedText )" & _
"SELECT Left(Text, InStr(1, Text, "" "") - 1) AS BOGUS;"
DoCmd.RunSQL strSQL

You can also assign the value of an unbound textbox with your string parsing and use the unbound textbox in your append query as the field and run the query directly while the form is open....or

You can create a recordset of the table and use the .Add & .Update methods of the recordset

Was this what you were looking for???

lwells

Reply With Quote
  #4  
Old July 11th, 2005, 03:41 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
For simplicity I would assign an unbound textbox to hold your variable on the form.

For example place a unbound textbox on your form (Hidden) and give it an appropriate name.

varTitle = Mid(varPasteString, varBeginTitle, varEndTitle - varBeginTitle)
Textbox1 = varTitle
Then modify the above sql slightly

Dim strSQL As String
strSQL = "INSERT INTO Table1 ( AppendedText )" & _
"SELECT [Textbox1] AS BOGUS;"
DoCmd.RunSQL strSQL

Use the same procedure for your other two variables.

lwells

Reply With Quote
  #5  
Old July 12th, 2005, 07:41 AM
boysherman boysherman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 5 boysherman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 3 sec
Reputation Power: 0
variables from a memo field and append query

thanks lwells. using hidden text boxes and setting their value to the variables worked.

many thanks,

bill

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > append query and variables from a memo field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT