How do I code this??

andy_dyer

Registered User.
Local time
Today, 08:38
Joined
Jul 2, 2003
Messages
806
Hi,

The problem:

On my database v1.4 at present every time a new record is created they must select which office is relevant to them. They do not always complete this field.

I know I could just make this a required field, but this would lead to more pop up error boxes for them (and there already a lot - error handling for every eventuality!!) so this time I would like to have one less box for them to complete...

I would like to be able to on the first use of my database v1.5 for the user be faced with a form forcing them to select their office location from a combo box cboOffice and it then this data is then stored in a table tblLocation.

Subsequently on my input form frmInput the current combo box cboOffice can be replaced with a locked text box txtOffice which already has their location in.

Is this possible and has anyone got any ideas on the coding required?

Thanks

Andy
 
Rather than store the field in the table. When they select their office from the form with the combo, Just hide that form but keep it open for the life of the Db.
You then do not need any Dlookup, SQL to retrieve the value, just refer to the combo on the form as the default value in a new record for the office eg

Default Value = Forms!NameofHiddenForm!OfficeCombo.

this is the easiest way to implement this (I feel)
 
Update!

After much trial and error I managed to get dlookup to work right and it all seems ok!!

Thanks

Andy
 
I forgot one thing...

How can I get it to start up the first time and access my frmLocation and every time after that to go to my frmMainMenu?

:confused:

Thanks

Andy
 
See, you did not need any help after all. ;)
 
Andy,

Just open it from the OnOpen event of your main form. It can
hide itself after they select the office.

Wayne
 
Thanks WayneRyan,

Although I didn't completely follow ur advice you did give me an idea...

I changed my startup sequence to open frmLocation 1st and then used the following code;

Private Sub Form_Load()

If IsNull(cboLocation) Then

Else
DoCmd.Close
DoCmd.OpenForm "frmMainMenu"

End If

End Sub

Now if the combo box is blank they get the frmLocation otherwise it closes even before it opens and moves straight to my frmMainMenu.

Thanks everyone for their help.

Andy
 

Users who are viewing this thread

Back
Top Bottom