Hi folks,
I’ve posted the beginnings of this question to Access World Forums and the Help Talk Forums but am still a bit shaky as to the answers I am getting.
Forgetting for the moment exactly what I am trying to do within the database[sup]*[/sup], my simple question is What is the shortest way to write data to a different table? Keeping it as simple as possible, suppose I have a form with a button that brings up an input box. The value typed into the input box is returned on screen with a message box. The Very Simple Code for the on-click event of the button is as follows:
[/quote]
Private Sub Command0_Click()
Dim tst As String
Dim tstinput As String
tstinput = InputBox(“Enter a word”, “Testing”)
tst = tstinput
MsgBox "test word is " & tst
End Sub
[/quote]
However, rather than display the tst string in a message box, I want to write that value to a table. That is, I want to replace the line *MsgBox “test word is “ & tst *with something that pastes the record into a table. The table I want to write to does not have any connection with the form. Either there is a simple way of doing this (i.e. I simply replace the last line with something along the lines of *[outside table].[outside table field] = tst *) or I need to go and learn all about recordsets and their manipulation.
Is there no such simple line of code that will do this? Is there no anti-DLookUp? Am I just missing a dim statement or something simple? It really grates against my intuition that to refer to a table I’d have several hoops to jump through, when [table name].[table field] uniquely identifies it to the DB engine. Thanks for any help you can give, and thanks for your patience.
Rhythmdvl
[sup]*[/sup]Tedious explanation or what I am trying to do for the curious:
I have a “Book” table and a “lecture” table. Both have several related (though mutually exclusive) tables, and both have a data entry form. On each form there is a memo field to enter long textual notes on the subject at hand. Beneath the memo field I have a subform that allows a user to enter in as many keywords as they’d like to describe the contents of the memo field. At the end of the semester, a simple report based on grouped keywords will give me a good index to work with. (I’ll also be able to see notes across classes, and which cases refer to which lectures, etc.) To keep things uniform, the two tables should work with the same keyword list so variants (i.e. “Adverse Possession” and “Adver. Poss.”) and such are kept to a minimum.
To create the keyword lists, I am using a combo box on the form that has limit to list turned and expand turned on. On the not in list event, I followed Access Help’s pretty straightforward example (from ‘NotInList Event — Event Procedures Example’) of how to add new words to the list. But the example has the row source type property set to ‘Value List’ and updates the local list. Since I have separate Book and Lecture tables to create a keyword list for, I’d like to save the new entries to a ‘Dictionary’ table rather than locally within the combo box’s properties. Therefore, I’d like to replace the * ctl.RowSource = ctl.RowSource & “;” & NewData* line with something simple, like [tblDictionary].[keywordfield] = NewData . In other words, I want to write the variable NewData to an outside table. Can this be done simply, or do I need to learn quite a lot to understand how to do it? Again, thanks for your patience.