boolean

kingsgambit

Registered User.
Local time
Today, 19:40
Joined
May 27, 2001
Messages
134
I am pretty new to vb codes, but I was trying to use the Boolean variable.
I have a main menu where users can select to search,edit or delete reocrds.
If they click the edit or delete button they go to a search form when they have found the record from a list they click the search button which will open the record in a new form. I have a form for each.
On the main form I put
Dim frmtype as Boolean
If they clicked edit
frmtype = true
If they clicked delete
frmtype = false
On the search form when they clicked search
if frmtype = true then Docmd.open...edit form
else
if frmtype = false the Docmd...open delete form.
But the search button does not openeach of the forms depending on the bollean state.
Can anybody help
Where should the code go on the forms?
 
If you have a separate form for edit, delete, and search, why don't you just use the button wizard to open each form depending on what button they push? Or to code it just put docmd.openform "formname" on the 'on click' action for each button.

That would be much simpler than all this logical business.
 
On the edit button's On_Click event you want to put the Docmd.OpenForm "edit form"

and then on the delete button's On_Click event you want to use the Docmd.OpenForm "delete form"

When you press the button that triggers an event, the button's On_Click event and since you have two buttons the above code is all you need.

Now, if you had a check box to select what form to open and one button, you would STILL put the code behind the On_Click event. But, it would work slightly differently. If you had an option group which would have only one option available at a time, then you could do this:

In the On_click event of the button -

Select Case optFormSelect
Case 1
Docmd.OpenForm "Edit Form"
Case 2
Docmd.OpenForm "Delete Form"
End Select

Hope that helps (hth)

BL
 

Users who are viewing this thread

Back
Top Bottom