Hi, I am learning about VBA as I go and the program I will need to use it for is Access. I started creating a database for work, having never even opened it before. I was thinking, "oh I am a wiz at Excel," but realized real quick, that knowing excel doesn't mean anything when learning Access.
There are not a lot of tutorials on Access VBA, AT ALL. Everything that I could find, assumed that I already knew how to run VBA and was just teaching me certain operations. But the problem there is, I know NOTHING about how to write code or anything. So I started tutorials on Visual Basic, itself, not for Access. I know there are some differences, but from what I understood it was more about language and how to call certain object, not the general structure of writing code. Like how to know what Private/Public, Sub/Function, etc.. means. I learned a lot of VBA jargon that has already helped me understand a little bit.
Problem being, on my very first attempt to create the simple, Enter "Hello, world!" into a textbox after clicking a command button.
So I...
1. Created a blank form and went to Design View
2. Inserted blank textbox
3. Inserted command button
4. Renamed as needed, (Textbox1/Command1)
5.Changed command button to say OK as caption
6. Opened VBA
7. Selected Command1 out of object list box and Click out of procedure list box
8. Typed: textbox.Text = "Hello, world!" between Sub and End Sub
Code simply reads:
Code:Option Compare Database Option Explicit Private Sub Command1_Click() Textbox1.Text = "Hello, world!" End Sub
I keep getting an error message that says:
"The expression On Click you entered as the event property setting produced the follow error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*There may have been an error evaluating the function, event, or macro."
I have tried researching and figuring out on my own, but I can't seem to find an answer.
Does anybody know why this would be happening?
Thank you!