Originally posted by dynamictiger
Private Sub CreateChart()
Dim DB As Database
Dim sqlState as String
Set DB = CurrentDb()
sqlstate = "SELECT * FROM tblRGAmo;"
DoCmd.OpenForm "Form1", , , sqlstate
I'm not positive, but I believe the semicolon on your sqlstate is causing the problem. Dynamictiger also makes a good point that your variable names should be explicitly declared and typed. It can save you hours of troubleshooting at a later date. You can remind yourself to develop this good habit by always putting the following line as the first or second line in each module you develop (including Forms!)
If you do this, when you compile, any undeclared variables will be reported as errors. This will save you though, trust me! If you mistype a variable name, the problem will be evident at compile time and you won't have to single step through all of your code to find out why some variable is behaving well in your app.