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

Date format and Management form !!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I using VBA code environment and SQL Server database.
I have two problems, i don't know how to do.
The first:
- I usually input date with (mm/dd/yyyy), but sometimes i want to input date (mm/yyyy). How to do this on the same field.
The second:
- In my program have many forms, how to manage form. Example: When form2 is opened by form1 i don't want form1 appear, but form2 is closed then form1 displayed (Note: form1 can open many forms).
Please help me. Thanks very much.
Ger
 
The first part
"- I usually input date with (mm/dd/yyyy), but sometimes i want to input date (mm/yyyy). How to do this on the same field."

I am not sure how to do the above. Why the difference. Wht can't you just alwasy do the field mm/dd/yyyy and just re-format the data when you need it? You could also write some code, on exit to check for correct formatting of either but I think it is not worth it.

The second part
Put the following code at the end of the VBA code/Event onclick for example

DoCmd.Close ' This closes form1
'Place form name to be opened in " " below
DoCmd.OpenForm "Form2", , , stLinkCriteria

Then do the same but revese when form2 closes it opens form 1 again. This does take alittle more time then leaving the forms open but I also like to only give the user one form at a time.
 
Thank you very much.
But can you explain for me about form management once more? Can you give me an example? I want to check form status after other forms are opened.
Example: Form2 is opened by form1, form3 is opened by form2. When form3 is closed then i want from2 is displayed. Sometimes from3 also is opened by form1, in this case when form3 is closed then form1 is displayed. Similar for other cases.
 
In your example what are the different methods that you are using to open form3 from form2 and form1 from form3(there are alot of the forms and froms)

Form2 ---> Form3 by button2?
Form2 ---> From1 by button1?
 
That's right
Form2 ---> Form3 by button2
Form2 ---> Form1 by button1
or
Form2 ---> Form3 by button3
Form1 ---> Form3 by button4
 
So for Form2 ---> Form3 by button2
you write the VBA code for onlick for button2
below
Private Sub button2_Click()
'This closes Form2
DoCmd.Close
'This open Form3
DoCmd.OpenForm "Form3", , , stLinkCriteria
End Sub

and so one...
 
The process needs to explained / understood more completly.

Is your app more-or-less the standard "switchboard" approach, where a 'master' form is used to call a single other form which always returns to the (master) swithboard? Or do you include 'trees' with variable paths through a set of forms, where you just need to always return to the "previous" form?

The 'switchboard' process is relatively simplistic, and may be accomplished in any of several ways. The latter is more complex. I (for the latter) usually use an array in a "stack" type of operation. Each time a 'new" form is opened, add the form's name to the stack. When one is closed. Pop it's name off of the stack, open the next form on the stack and close the current one.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top