Store results into a table

  • Thread starter Anna Peters via AccessMonster.com
  • Start date
A

Anna Peters via AccessMonster.com

Hi all,
The following url at is an example of url's stored in the stat_keywords
table: /index.cfm?
section_id=24&need_help_stat_id=5&geriatric_topic_id=4&sub_section_id=33&page_id=48&tab=1

I needed to split the url at the '&', which is accomplished with the
following code. BUT now I want the results to be stored in a table rather
than output to a message box, how can this be accomplished???

Private Sub Command10_Click()
Dim strURL As String
Dim tempstring As String
Dim counter As Integer
Dim p As Integer
Dim i As Integer

counter = 0

strURL = "index.cfm?
section_id=24&geriatric_topic_id=4&sub_section_id=34&page_id=49&tab=2"

For p = 1 To Len(strURL)

tempstring = Mid(strURL, p, 1)

If tempstring = "&" Then counter = counter + 1

Next p

For i = 1 To counter

tempstring = Split(strURL, "&")(i)

MsgBox tempstring

Next i

End Sub
 
G

Guest

Well, first you have to have a table:

Create the table with a single field "tempstring"

See the code changes below:

Anna Peters via AccessMonster.com said:
Hi all,
The following url at is an example of url's stored in the stat_keywords
table: /index.cfm?
section_id=24&need_help_stat_id=5&geriatric_topic_id=4&sub_section_id=33&page_id=48&tab=1

I needed to split the url at the '&', which is accomplished with the
following code. BUT now I want the results to be stored in a table rather
than output to a message box, how can this be accomplished???

Private Sub Command10_Click()
Dim strURL As String
Dim tempstring As String
Dim counter As Integer
Dim p As Integer
Dim i As Integer
Dim out_tbl as DAO.recordset

set out_tbl = currentdb.openrecordset("THis is your table name")

out_tbl.movelast => gets you to the end of the table
counter = 0

strURL = "index.cfm?
section_id=24&geriatric_topic_id=4&sub_section_id=34&page_id=49&tab=2"

For p = 1 To Len(strURL)

tempstring = Mid(strURL, p, 1)

If tempstring = "&" Then counter = counter + 1

Next p

For i = 1 To counter

tempstring = Split(strURL, "&")(i)

MsgBox tempstring

out_tbl.addnew
out_Tbl!tempstring = tempstring
out_tbl.update




set out_tbl = nothing
 
A

Anna Peters via AccessMonster.com

Hi BCA,
Thanks for your reply. How can I get the code to read url's from a field in
the same table and then output the results to the table.

Here are the fields,

stat_keywords: url, stat_id, visit_history_create_date

Thanks for help.
 

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

Top