Access VBA coding problem
Can anyone help me please?? I have a field on an Access report called "Company name". I have a command button in place that runs VBA code. This code is suppose to trap the text input of the user and then store in on the report field called "Company Name". How ever when I click the button and fire the code, I get an error message telling me that the field name is incorrect, or renamed or deleted. My code reads as follows:
Private Sub Command159_Click()
On Error GoTo Err_Command159_Click
Dim stDocName As String
stDocName = "Order Questionaire"
DoCmd.OpenReport stDocName, acPreview
Dim MyPrompt As String
InputBox "Enter Company Name:"
Me!MyPrompt = [Company Name]
Exit_Command159_Click:
Exit Sub
Err_Command159_Click:
MsgBox Err.Description
Resume Exit_Command159_Click
End Sub
Any idea's? It's worth a case of beer to someone!