Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access generating code but getting an error

Status
Not open for further replies.

Xtremlylost

Technical User
Jul 18, 2002
25
US
I am trying to open a new form (Claimfrm) and set two of the fields from the original form (Complaintfrm). I used the command button wizard and Access generated the following code: (Copied directly from the window)

Private Sub Command28_Click()
On Error GoTo Err_Command28_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Claimfrm"

stLinkCriteria = "[Claims.CarComplaintID]=" & Me![CarComplaintID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command28_Click:
Exit Sub

Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click

End Sub


The problem is I keep getting an error stating that I have "Invalid bracketing of '[Claims.CarComplaintID]. I haven't touched this code so I am wondering why Access generated code that would cause an error and if anyone sees any reason that this is not working.

Thanks in advance for any help.
Xtremelylost
 
Hi,

Try [Claims].[CarComplaintID] instead of [Claims.CarComplaintID]


N
 
This eliminated the error! Thank you. The form is still not working as I had hoped so I have another question. This was supposed to open the (Claimfrm), generate a new record and pull the (ComplaintID) from the (Complaintfrm)which in turn should allow all the information from the (Complaintfrm) to fill in the (Claimfrm)'s shared fields. I am guessing that the code that I supplied through the wizard was looking for matching records in both forms. This is not what I was trying to do since there would not be a matching record in the (Claimfrm). The whole intention was to generate a whole new record to add claim information (which is not often needed) if it were necessary. Can you tell me which way I need to be headed?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top