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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent problem with OnOpen event

Status
Not open for further replies.

Rauken

Programmer
May 11, 2004
98
0
0
SE
I'm helping my client to adjust their report in Access 2000 so it can show images stored in a sql server.

Everything worked fine until I noticed that the query the report is based on takes parameter values. What happens is that my code in OnOpen event executes before the user has entered the value in the parameter form!

I have code that looks like this:

strRecSource = Me.RecordSource
Set db = CurrentDb
strSql = "SELECT * FROM " & strRecSource & " WHERE
file_type = 'jpg'"

Set rs = db.OpenRecordset(strSql)

The problem is that the Recordsource of the form is not set until the user enter the parameter value for the query!

Anyway around this?

 
Solved my own problem :)

I moved the code to the Format event. Now each image is created in the Format event instead of creating all at once in the OnOpen event.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top