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?
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.
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
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.
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