Originally posted by Dököll
connecting to ms access with vb6
Collapse
X
-
You're right, I completely missed that post...
Fantastic, I need you to do 3 things:
(1) Go to the properties of the two Textboxes you have on loginfrm.frm
(2) Give me the names showing for each Textbox properties
(3) Provide me the code you have written for loginfrm.frm
I need to see your code whether or not it works, ok.
In a bit...Comment
-
Hey sajib!
Here is a good way you can get some help in this:
(1) Copy the post you added here
(2) Start a new discussion (you'll see link to your upper right to do this)
(3) Paste the post in the body
(3) Add LIBRARY MANAGEMENT ODBC CONNECTION in the subject line
(3) Submit your post
It will be a little more specific to your needs. Please forgive me, I am currently aiding Yoda. If nothing pops up for you, I'll take a look when Yoda and I have mastered the project at hand.
Good luck sajib!
DököllComment
-
Originally posted by DököllYou're right, I completely missed that post...
Fantastic, I need you to do 3 things:
(1) Go to the properties of the two Textboxes you have on loginfrm.frm
(2) Give me the names showing for each Textbox properties
(3) Provide me the code you have written for loginfrm.frm
I need to see your code whether or not it works, ok.
In a bit...
the first text box is called txtUserName and the second is txtPassword
the code i'm using is the code u provide in the couple of apges but i'll post it any way.
Code:Option Explicit Public LoginSucceeded As Boolean Private Sub cmdCancel_Click() LoginSucceeded = False 'Micorsoft code Me.Hide Login.Visible = False End Sub Private Sub cmdOK_Click() frmSplash.Visible = False Login.Visible = True End If txtPassword = "password1" Then 'change the password here if you do not like it, Y045DA, or something in that kind of a line LoginSucceeded = True Me.Hide Login.Visible = False About.Visible = True LoginSucceeded = True Me.Hide Else MsgBox "Invalid Password, try again!", , "Login" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End Sub Private Sub Form_Load() lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision lblProductName.Caption = App.Title 'Simply Yoda should be good here End SubComment
-
Yoda, I hope you're ready for this:
(1) Delete the code you have for loginfrm.frm
(2) Copy and paste below code in there
(3) Run the code
(4) Add YodaDude for User name
(5) Add password1 for Password
(6) Tell me what message pops up
Answer the above and we'll continue.Code:Option Explicit Public LoginSucceeded As Boolean Private Sub cmdCancel_Click() LoginSucceeded = False Me.Hide loginfrm.Visible = False End Sub Private Sub cmdOK_Click() If txtUserName = "YodaDude" Then If txtPassword = "password1" Then LoginSucceeded = True Me.Hide MsgBox "Yoda, I think we've got it!" Else MsgBox "Sorry! Invalid Password, please try again.", , "loginfrm" txtUserName.SetFocus SendKeys "{Home}+{End}" End If End If End Sub
Good luck!
DököllComment
-
like i said the code works but i've used that code before and it worked, but wat if i want wat ever is in the user name txt box and the password txt box to be sent to the database called Yoda1.mdb on table Yoda.
Yoda thanks for the help i know we will get through this :-)....Comment
-
Groovy...
No worries, by the way, Yoda, we'll get to the database in a moment...
I need you to do me the biggest favor.
IMPORTANT:
(a) Close the application
(b) Make a folder call it VBFormCopy1 (or anything you want)
(c) Save a copy the project in this new folder
(d) After saving this copy, go in that folder and run the project
(e) If the project runs identically to the original project
(f) Continue with the below instructions
+++++++++++++++ +++++++++++++++ +++++++++++
You will need a new form that will receive info from your wonderful Yodamania table (part of your Yoda.mdb).
Please do the following:
STEP 1
(1) Make a new VB form
(2) Go to Project, Choose Add form (Form1 is by default, no need to rename it)
(3) Drag 5 Textboxes to your form, Text1, Text2, Text3, Text4, Text5
(4) Add 2 command buttons, name 1 Search and the other Retrieve
(5) Close the application
(6) When you are prompted to Save, just save
**Do not rename the new form**
+++++++++++++++ +++++++++++++++ +++++++++++
After you have done the above tell me the following:
STEP 2
(a) Name of each Textbox in the properties window
(b) Name of each Command button in the properties windowComment
-
Step 2 A) it goes in order Text1, Text2 soon on and soon on.Originally posted by DököllGroovy...
No worries, by the way, Yoda, we'll get to the database in a moment...
I need you to do me the biggest favor.
IMPORTANT:
(a) Close the application
(b) Make a folder call it VBFormCopy1 (or anything you want)
(c) Save a copy the project in this new folder
(d) After saving this copy, go in that folder and run the project
(e) If the project runs identically to the original project
(f) Continue with the below instructions
+++++++++++++++ +++++++++++++++ +++++++++++
You will need a new form that will receive info from your wonderful Yodamania table (part of your Yoda.mdb).
Please do the following:
STEP 1
(1) Make a new VB form
(2) Go to Project, Choose Add form (Form1 is by default, no need to rename it)
(3) Drag 5 Textboxes to your form, Text1, Text2, Text3, Text4, Text5
(4) Add 2 command buttons, name 1 Search and the other Retrieve
(5) Close the application
(6) When you are prompted to Save, just save
**Do not rename the new form**
+++++++++++++++ +++++++++++++++ +++++++++++
After you have done the above tell me the following:
STEP 2
(a) Name of each Textbox in the properties window
(b) Name of each Command button in the properties window
B) first button called search on form, in properties called cmdSearch,
second button called Retrieve on form, properties called cmdRetrieve.
thanks for helping me again ;)Comment
-
Sorry Yoda, I goofed a little bit...
Could you change the cmdSearch button name to cmdAdd in properties?
Silly me, we cannot have two search buttons, Search and Retrieve will confuse us. Please remove before you look at the rest of this post
=============== =============== ============
If your new form is called Form1.frm
(1) Go to your loginfrm.frm code
(2) Look for part of the code MsgBox "Yoda, I think we've got it!"
(3) Change it to:
Form1.Visible = True
loginfrm.Visibl e = False
(4) Run the code
(5) Add your user name and password
(6) Tell me if Form1 is the form shown
What you are doing is, you want to make sure your loginfrm form disappears and Form1 is the only one showing...
Tell me what happens, and we'll continue..Comment
-
Originally posted by DököllSorry Yoda, I goofed a little bit...
Could you change the cmdSearch button name to cmdAdd in properties?
Silly me, we cannot have two search buttons, Search and Retrieve will confuse us. Please remove before you look at the rest of this post
=============== =============== ============
If your new form is called Form1.frm
(1) Go to your loginfrm.frm code
(2) Look for part of the code MsgBox "Yoda, I think we've got it!"
(3) Change it to:
Form1.Visible = True
loginfrm.Visibl e = False
(4) Run the code
(5) Add your user name and password
(6) Tell me if Form1 is the form shown
What you are doing is, you want to make sure your loginfrm form disappears and Form1 is the only one showing...
Tell me what happens, and we'll continue..
It does what the code says once u hit ok from1 shows up, but when i hit ok on the frmlogin nothing happens when theres nothing in the txt box it should pop up a msg box saying invaild password but it doesn't but no big deal so we'll continue.
yodaComment
-
I noticed you changed the name of your database. Are you now saying the database is called Yoda1.mdb and that the table is now called Yoda:
If this is the case, do the following:
STEP 3
(1) Find the database you now call Yoda1.mdb
(2) Right-click on it, then select Copy
(3) Right-click on the Start button on your desktop/ or notebook
(4) Choose Explore
(5) Go to Local Disk C: (your C: drive)
(6) Paste Yoda1.mdb on your C: Drive
=============== =============== ============
STEP 4
Make sure the database table column names are the following:
(a) UserID
(b) Name
(c) Address
(d) Phone
(e) Email
WARNING:
VB must have the proper column names to know where to add for data
If none of the above fits what you have as database and table, or if you still have Yodamania as table and Yoda.mdb as database, you'll need modify this information before we can go on to STEP 5...Comment
-
Provided you want to keep your database as Yoda1.mdb and your table as Yoda, please go to:
STEP 5
Add data to this databse of yours through, Text1, Text2, and so on..., then hit your cmdAdd button.
After you have added data to your table named Yoda:Code:Private Sub cmdAdd_Click() Dim my_database As Database Set my_database = OpenDatabase("C:\Yoda1.mdb") my_database.Execute "insert into Yoda1.Yoda(UserID, Name, Address, Phone, Email) Values('" & Text1.Text & "','" & Text2.Text & "' , '" & Text3.Text & "' , '" & Text4.Text & "','" & Text5.Text & "')" my_database.Close ' Text1.Text="" Text2.Text="" Text3.Text="" Text4.Text="" Text5.Text="" End Sub
(1) Minimize your VB application
(2) Go to your C: Drive to look in Yoda1.mdb
(3) Tell me if data was in fact added to Yoda
Note: You must close Yoda1.mdb if you are going to add additional data to it through VB...
Good luck!Comment
Comment