Save Website URLs to Table (1 Viewer)

Thales750

Formerly Jsanders
Local time
Today, 12:45
Joined
Dec 20, 2007
Messages
2,151
What is the best way to do something like this?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:45
Joined
Oct 29, 2018
Messages
21,581
Like what data type to use: Hyperlink or Short Text?
 

Thales750

Formerly Jsanders
Local time
Today, 12:45
Joined
Dec 20, 2007
Messages
2,151
Like what data type to use: Hyperlink or Short Text?
I currently manage it manually by copying the URL,
Then use a button to paste into a form (table).

It pastes it twice, one hidden, the other displayed. It gives the option of writing something meaningful.

Automatic would be nice.
I appreciate your input on this.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:45
Joined
Feb 19, 2002
Messages
43,607
How would Access know what URL you wanted if you didn't copy it first?
 

Edgar_

Active member
Local time
Today, 11:45
Joined
Jul 8, 2023
Messages
438
Where are you copying from? Is it abother table? Another form? Excel? An actual website? Where is the button? Where is the table? What structure does it have? Why did you choose to copy manually? Why does it paste it twice? Is that a intentional or not? Why one hidden? What does hidden mean?
 

Thales750

Formerly Jsanders
Local time
Today, 12:45
Joined
Dec 20, 2007
Messages
2,151
How would Access know what URL you wanted if you didn't copy it first?
Well that's it. It wouldn't. There are some Chrome Extensions that write the current URL to a Google Sheet. that would maybe work.
I was just hoping someone may have gone on an awakening and discovered some magic.
 

Thales750

Formerly Jsanders
Local time
Today, 12:45
Joined
Dec 20, 2007
Messages
2,151
Where are you copying from? Is it abother table? Another form? Excel? An actual website? Where is the button? Where is the table? What structure does it have? Why did you choose to copy manually? Why does it paste it twice? Is that a intentional or not? Why one hidden? What does hidden mean?
Actual website.
It paste it twice because I told it to.

Code:
    If Not IsNull(Me.txtAttachment) Then Exit Sub
    If Not IsNull(Me.txtDescription) Then Exit Sub

    Me.txtAttachment.SetFocus
    DoCmd.RunCommand acCmdPaste
    Me.txtDescription.SetFocus
    DoCmd.RunCommand acCmdPaste

Me.txtAttachment is the actual link
Me.txtDescription is what the User sees. This can be changed for clarity by the User
 

Edgar_

Active member
Local time
Today, 11:45
Joined
Jul 8, 2023
Messages
438
Best way to get urls from a website depends on the website structure, can you provide an example of how the HTML structure looks like?
 

Thales750

Formerly Jsanders
Local time
Today, 12:45
Joined
Dec 20, 2007
Messages
2,151
It would be magic if Access could read your mind.
It doesn't require mind reading. i wasn't asking for an Access solution. In fact i mentioned that there are Chome extentions that download the URL of the current web page into a tabe.
I was wondering if anyone had ever taken it the next step.

I appreciate some folks taking an interest. this is obviously something no one else has though to important. I mostly do project management and ERP I do a lot to linking outside the standard models. one of those is to link Webpages to many different entities in the database. copying it manually from the current webpage is not too much trouble.
A simple copy button would be cool.
 

sxschech

Registered User.
Local time
Today, 09:45
Joined
Mar 2, 2010
Messages
801
this example doesn't address getting the data into the clipboard, just getting it out using vba to paste data from the clipboard into a field of a table.

if using edit rather than addnew, you will need additional code to locate the correct record to be updated.

Code:
Sub TestCliptable()
'Paste data from the clipboard into a table
    Dim db As dao.Database
    Dim rs As dao.Recordset
    Set db = CurrentDb
'Change tblData to the name of the table where the data will be stored
    Set rs = db.OpenRecordset("tblData", dbOpenDynaset)

'Uncomment one of the lines below
'for either adding a new record or editing an existing record
'    rs.AddNew  'Insert New Record uncomment this line
'    rs.Edit    'Edit an existing record to include new data uncomment this line

'Change rs!Contents to the name of the field where the data
'will be pasted
    rs!Contents = PasteFromClip
    rs.Update
    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing
End Sub

Included the paste code below. Add it to a code module and not a form module.
The Const line goes at the very top of your code in the declarations section and the function code can be placed elsewhere in a code module

Const DATAOBJECT_BINDING As String = "new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}" 'http://bytecomb.com/copy-and-paste-in-vba/


Code:
Public Function PasteFromClip() As String
'http://bytecomb.com/copy-and-paste-in-vba/
    With CreateObject(DATAOBJECT_BINDING)
        .GetFromClipboard
        PasteFromClip = .GetText
    End With
End Function
 

Users who are viewing this thread

Top Bottom