pg1533
asked on
Object Required Error
Hi,
I have attached an excel 'Forecast-Tool' and it has the form named 'LoginFrm' created. When I open this excel the 'LoginFrm' would popup to ask for login credentials. I will give user name as 'Prashanth' and the password is 'X'. Once, I click on Login button then I get the error as 'Object Required' This workbook will be connected to 'ForecastToolDatabase.mdb' file which is also attached.
I am not able to identify where is the problem. It would be of great help if you could do the needful. Thanks for your time and support.
Regards,
Prashanth
Forecast-Tool.xlsm
ForecastToolDatabase.mdb
I have attached an excel 'Forecast-Tool' and it has the form named 'LoginFrm' created. When I open this excel the 'LoginFrm' would popup to ask for login credentials. I will give user name as 'Prashanth' and the password is 'X'. Once, I click on Login button then I get the error as 'Object Required' This workbook will be connected to 'ForecastToolDatabase.mdb'
I am not able to identify where is the problem. It would be of great help if you could do the needful. Thanks for your time and support.
Regards,
Prashanth
Forecast-Tool.xlsm
ForecastToolDatabase.mdb
PS. The reason for the change that was necessary within the clsADODB.ConnecttoDatabase () subroutine was due to the incomplete advice you were offered here:
[ https://www.experts-exchange.com/questions/28144627/Form-in-Excel.html?anchorAnswerId=39212381#a39212381 ]
[ https://www.experts-exchange.com/questions/28144627/Form-in-Excel.html?anchorAnswerId=39212381#a39212381 ]
ASKER
It would be of great help and I really appreciate, if you could resolve this problem also. Thank you so much for your time, patience and support.
Regards,
Prashanth
Regards,
Prashanth
Hi again,
Change this line:
To read like this:
You should then see the "Success" (information) MessageBox.
BFN,
fp.
Change this line:
objRSet.Open "SELECT UserDetails.UserName, UserDetails.FullName, UserDetails.UserCat, UserDetails.Password FROM UserDetails WHERE (((UserDetails.UserName)='" & Trim(LoginFrm.LoginFrmUserText.Text) & "') AND ((tblUser.Password)='" & Trim(LoginFrm.LoginFrmPassTxt) & "'));", clsADODB.objCon
To read like this:
objRSet.Open "SELECT UserName, FullName, User_Cat, Password FROM UserDetails WHERE UserName='" & Trim(LoginFrm.LoginFrmUserText.Text) & "' AND Password='" & Trim(LoginFrm.LoginFrmPassTxt) & "'", clsADODB.objCon
You should then see the "Success" (information) MessageBox.
BFN,
fp.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Fanpages,
You are Genius. Thank you so much for all your support and time. I would continue to work on the project. I would definitely raise another question if I get any doubt.
Once again thank you so much. Take care.
Regards,
Prashanth
You are Genius. Thank you so much for all your support and time. I would continue to work on the project. I would definitely raise another question if I get any doubt.
Once again thank you so much. Take care.
Regards,
Prashanth
ASKER
Thank you
You are very welcome, Prashanth.
If I spot your further question(s), & nobody else is assisting you, I will try to contribute if I am able to.
BFN,
fp.
If I spot your further question(s), & nobody else is assisting you, I will try to contribute if I am able to.
BFN,
fp.
I changed the modLoginForm code module to read:
Open in new window
I also changed the clsADODB.ConnecttoDatabase
The previous line:
Open in new window
Now reads:
Open in new window
(ActiveWorkbook becomes ThisWorkbook)
The code now progresses to the SQL statement within the modLoginForm.btn_Login_Cli
Open in new window
However, this fails with the error message:
"[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2."
Do you need this problem resolving or are you capable of looking at this yourself?
BFN,
fp.