runtime error 2450

  • Thread starter Thread starter inchong
  • Start date Start date
I

inchong

I have a preview button(cmdbutton) in a form. when i click this button
it suppose to bring a different form( i call this mainform(check the
below code)). But that didn't happen. so i checked Mainform code and
had a problem on this line.
CurrentDB = Forms![MainForm]![subform].Form![DatabaseName] with
runtime error 2450 msg.
When i output CurrentDB and it was showing ""
but ssal displayed the right db. with other strings.

Private Sub Form_Open(Cancel As Integer)
Dim CurrentDB As String, ssql As String, MyFilter As String
'Stop
CurrentDB = Forms![MainForm]![subform].Form![DatabaseName]
ssql = "SELECT * FROM DOCUMENTS IN "
ssql = ssql & "'" & CurrentDB & "'"

is there anything wrong in syntax?
does anyone has any idea what i did wrong here.
everytime i open this MainForm i get runtime error 2450.
it says that MS ACCESS cannot find the form "MainForm" ~~~~~~ in VB
code.

Please help me.
 
The first thing I notice is that you use the variable CurrentDb. That's a
reserved variable in Access. Maybe that's the problem. Try another.
 
Back
Top