Posted on 1997-11-22
I'm using visual basic 4. My program contains 2 forms and one module. Form1 has a DBCombo box style 1, a Data Control which is connected with the DBCombo and my access file and a command button. Form2 has few text boxes and a Data Control with the necessary connection between it and the text boxes and my access file.
In the lower portion of my DBCombo in Form1 a list of movie titles are displayed from my access file. The user will type the title he is looking for in the upper portion of the DBCombo and the list of titles will automatically scroll down according to what the user types (that is because it's style 1). Once the title have been allocated in the list I then want my program to display information of that particular title in the text boxes in form2 when the user clicks on the command button in Form1. This is the code I have come up with so far:
First I type the following in my module
Count = 0
Second I typed the following in my button command click
MovieName = Combo1.Text
Count = 1
Finally I typed the following in my Form2 load
If count = 0 then
Data1.RecordSource = varname
data1.recordset.findfirst "fieldname =" & "'" & MovieName & "'"
count = 0
However when I try running my program I get an Error message saying "Invalid Outside Procedure" on the zero in the statement "count = 0" in the module. What am I doing wrong? And does anyone have any better ideas on how to make my DBCombo work? Your help is appreciated! :)