473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

New User Button

173 100+
Alright peeps,

Im trying to add details to a database called "tab_main". I wana add details such as phone number, name, imei no, PUK code, tariff etc etc for a mobile phone user.

Ive created an empty form with all the neccesary text fields and also a seperate form for just the New User button (the way i would like it l ).

I need some help and advice................

How do i click on the New User Button and show the empty form on a new window? and also on the empty form, i need an 'add button' that will allow me to add the details once the form is completed??? ANY1 GOT THE full CODE FOR THIS? OR ARE THERE ANY EXAMPLES AVAILABLE FOR ME TO VIEW????????????

Ur response will be highly appreciated.... thank you
Nov 15 '06 #1
4 1468
MMcCarthy
14,534 Expert Mod 8TB
Beany

I'm not sure what you mean. Normally to add records to a table or query you create a form bound to the table or query and put controls on the form bound to each of the fields. The form wizard can help with this.


Alright peeps,

Im trying to add details to a database called "tab_main". I wana add details such as phone number, name, imei no, PUK code, tariff etc etc for a mobile phone user.

Ive created an empty form with all the neccesary text fields and also a seperate form for just the New User button (the way i would like it l ).

I need some help and advice................

How do i click on the New User Button and show the empty form on a new window? and also on the empty form, i need an 'add button' that will allow me to add the details once the form is completed??? ANY1 GOT THE full CODE FOR THIS? OR ARE THERE ANY EXAMPLES AVAILABLE FOR ME TO VIEW????????????

Ur response will be highly appreciated.... thank you
Nov 17 '06 #2
NeoPa
32,556 Expert Mod 16PB
I'm not sure exactly what you're after here, but I've designed a form class which enables the code to open one form from another. The calling object is automatically hidden until the called form is closed, at which time the calling form is reshown.

Class - classForm
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private WithEvents frmTo As Form
  5.  
  6. Private frmParent As Form
  7.  
  8. Public Property Set frmFrom(frmValue As Form)
  9.     Set frmParent = frmValue
  10. End Property
  11.  
  12. Private Property Get frmFrom() As Form
  13.     Set frmFrom = frmParent
  14. End Property
  15.  
  16. Public Function ShowForm(strTo As String) As Boolean
  17.     ShowForm = True
  18.     'Handle error on OpenForm() only.
  19.     On Error GoTo ErrorSF
  20.     Call DoCmd.OpenForm(strTo)
  21.     On Error GoTo 0
  22.     Set frmTo = Forms(strTo)
  23.     frmFrom.Visible = False
  24.     Exit Function
  25.  
  26. ErrorSF:
  27.     ShowForm = False
  28.     Call ErrorHandler(strName:=strTo, _
  29.                       strFrom:=frmFrom.Name & ".ShowForm", _
  30.                       lngErrNo:=Err.Number, _
  31.                       strDesc:=Err.Description)
  32. End Function
  33.  
  34. '************************* Contained Object Method(s) *************************
  35. 'For these subroutines to be activated the contained object must have the
  36. ''On Close' property set to a valid subroutine within the contained object.
  37. Private Sub frmTo_Close()
  38.     frmFrom.Visible = True
  39.     Set frmTo = Nothing
  40. End Sub
  41. '******************************************************************************

This is an example of the code for (my main menu) form which uses it (as a calling and a called form).
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private clsTo As New classForm
  5.  
  6. Private Sub Form_Open(Cancel As Integer)
  7.     Call DoCmd.Restore
  8.     Set clsTo.frmFrom = Me
  9. End Sub
  10.  
  11. Private Sub cmdAdHocMenu_Click()
  12.     Call clsTo.ShowForm(strTo:="frmAdHocMenu")
  13. End Sub
  14.  
  15. Private Sub cmdCustSPMenu_Click()
  16.     Call clsTo.ShowForm(strTo:="frmCustSPMenu")
  17. End Sub
  18.  
  19. Private Sub cmdExit_Click()
  20.     Call DoCmd.Close(ObjectType:=acForm, ObjectName:=Name)
  21. End Sub
  22.  
  23. Private Sub Form_Close()
  24.     'Allows container to handle event.
  25. End Sub
Notice the Form_Close() sub MUST exist - even if it contains only a comment line.
Nov 18 '06 #3
PEB
1,418 Expert 1GB
It seems me that this is a wizard for this!

Main/Subform wizard that creates separate forms and fills them on clicking a bouton... But in the old versions this wizard isn't present!

The code that you have to adapt is:

Expand|Select|Wrap|Line Numbers
  1. Sub Form_Current()
  2. On Error GoTo Form_Current_Err
  3.  
  4.     If ChildFormIsOpen() Then FilterChildForm
  5.  
  6. Form_Current_Exit:
  7.     Exit Sub
  8.  
  9. Form_Current_Err:
  10.     MsgBox Error$
  11.     Resume Form_Current_Exit
  12.  
  13. End Sub
  14. Sub ToggleLink_Click()
  15. On Error GoTo ToggleLink_Click_Err
  16. default_object_value = Me.[ID_obj]
  17.     If ChildFormIsOpen() Then
  18.         CloseChildForm
  19.     Else
  20.         OpenChildForm
  21.         FilterChildForm
  22.     End If
  23.  
  24. ToggleLink_Click_Exit:
  25.     Exit Sub
  26.  
  27. ToggleLink_Click_Err:
  28.     MsgBox Error$
  29.     Resume ToggleLink_Click_Exit
  30.  
  31. End Sub
  32. Private Sub FilterChildForm()
  33.  
  34.     If Me.NewRecord Then
  35.         Forms![Object_info].DataEntry = True
  36.     Else
  37.         Forms![Object_info].Filter = "[ID_obj] = " & Me.[ID_obj]
  38.         Forms![Object_info].FilterOn = True
  39.     End If
  40.  
  41. End Sub
  42. Private Sub OpenChildForm()
  43.  
  44.     DoCmd.OpenForm "Object_info", acFormDS
  45.     If Not Me.[ToggleLink] Then Me![ToggleLink] = True
  46.  
  47. End Sub
  48. Private Sub CloseChildForm()
  49.  
  50.     DoCmd.Close acForm, "Object_info"
  51.     If Me![ToggleLink] Then Me![ToggleLink] = False
  52.  
  53. End Sub
  54. Private Function ChildFormIsOpen()
  55.  
  56.     ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Object_info") And acObjStateOpen) <> False
  57.  
  58. End Function
  59.  
  60.  
  61.  
Alright peeps,

Im trying to add details to a database called "tab_main". I wana add details such as phone number, name, imei no, PUK code, tariff etc etc for a mobile phone user.

Ive created an empty form with all the neccesary text fields and also a seperate form for just the New User button (the way i would like it l ).

I need some help and advice................

How do i click on the New User Button and show the empty form on a new window? and also on the empty form, i need an 'add button' that will allow me to add the details once the form is completed??? ANY1 GOT THE full CODE FOR THIS? OR ARE THERE ANY EXAMPLES AVAILABLE FOR ME TO VIEW????????????

Ur response will be highly appreciated.... thank you
Nov 18 '06 #4
Beany
173 100+
thanks fellas,

im gonna have a try with the info u have provided!

cheers
Nov 18 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Technical Group | last post by:
Friends, Can anybody help me out by sending a piece of C# code showing how to add an active directory user to a particular user group? If the group does not exist, then create it. Thanks in...
1
by: Josema | last post by:
Hi, Im starting to do the navigation of a portal, and for it, im using usercontrols.... Actually i have a user control in the top of the page that has some menus (contact, register, etc...) ...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
5
by: Jonah Olsson | last post by:
Hello guys, I have an application which is built upon several user controls. That is, I have a default template (default.aspx) that I load a user control into (using placeholders in the...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
5
by: Dave | last post by:
(Second Try) Greetings, I have an asp.net web application that utilizes a User Control at the top of the page. My User Control contains a Server Control menu which will require postbacks. ...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.