choudhuryshouvi 33 Posting Pro

you have to set the TAB INDEX property of the option buttons. select the desired control and press F4 to open its properties,scroll down and find the tab index property. there you put the value. this value becomes the sequence number after which the focus will be moved to the desired control.

For example, if you set tab index of option1 to 0 and option 2 to 1, whenever you open the form the option 1 will be selected as default. then you can press tab to easily move the focus from option 1 to option 2. in the same way you can also set the tab index for other controls also.

hope this will help.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

Thanks Shouvik, can you please give me guidelines on how to use vb6's visual data manager to create the database.

it's a long time process. have you tried your program after downloading and installing the patch files yet??? first try it and if it won't work i'll surely tell you the steps.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

Sir I'm using Oracle9i database.

choudhuryshouvi 33 Posting Pro

When I'm trying to update information in the database vb6 is fetching me the following error:-

"Row cannot be located for updating.
Some values may have been changed since it was last read."

what is the cause and remedies for the above error?

choudhuryshouvi 33 Posting Pro

Thanks Shouvk for the support, but still there is a problem when i run the program. A run-time error '3343': occurs. It says "unrecognised database format 'C:\Documents and Settings\Sugar\My Documents\VBpro\toroo\Employee.mdb ' .
Need help to fix this problem.

have you created the database by using ms-access software of versions higher than office 97???
if yes then i'm sorry to say that you cannot access the database from vb. because vb6 has the limitation on accessing the Access databases rather than office97 format. in such circumstances you have to create the database using vb6's visual data manager. then there will be no problem in accessing the database from your vb program. now if you don't wish to do this then you need to install the service pack 4 patch of vb6. visit the following link to get the vb6 service pack 6 files :- http://www.microsoft.com/downloads/details.aspx?familyid=7b9ba261-7a9c-43e7-9117-f673077ffb3c&displaylang=en

after you have downloaded the above file, install it and then try to run your program. there should not be any problem now.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

try this one

under form_load() :-

Timer1.Enabled=False

under cmdswing_click() :-

Timer1.Enabled=True

choudhuryshouvi 33 Posting Pro

Nevermind... I figured it out. Using SQL of the QueryDefs overwrites the original query in the database with the new one. This thread can be closed.

Set dbsAccess = DBEngine.Workspaces(0).OpenDatabase(dbFile$, False, False)
Set qd = dbsAccess.QueryDefs("Agency Query")
qd.SQL = "SELECT...
dbsAccess.Close

if you have benefited from the reply then post a feedback and mark the thread as solved.

choudhuryshouvi 33 Posting Pro

Pls i also need to know how to use DAO instead of ADO Because i know a bit of ADO Connection and am seeking to know as a fresh user of DAO connect to the Database, You can email some few example if present OR send the site that give tutorial on either online or ebooks pls send the detail to the address below
atplerry@yahoo.com

check out this sample project.
it was created in DAO technique and it has everything u need to know about connecting the database using DAO object and frequently used database operations.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

I have a VB6 application that uses DAO to read and write MS Access files. Since the program uses Access files exclusives, it was written in DAO instead of ADO. The recordsets within the program are based on queries in the database. I need to add a field to the table and query. I'm sure I can figure out testing for the existence of the field in. My question: How can I add a new field to the table AND query?

check this sample code in the attachment.
hope this will be able to give u some idea.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

what database are you using for your project???

if you wish to update ur database from diff. computers you have to use such a database which provides client-server architecture. make a try to use the oracle or sql server database.

hope this helps

regards
Shouvik

choudhuryshouvi 33 Posting Pro

there is no networking facility available in this context. to update ur data in the main server from diff. computers use a database which can be used in client-server architecture. for example, u can use oracle db for this purpose. install a server copy in a centralized machine and then install separate copies into separate diff. client computers. the centralized machine will become ur data server. to connect the client with the server u have to mention the ip of the server in each of ur client. in oracle u can do this easily by using net config. manager of oracle itself. once these process complete u can send data from diff. computers and it will update ur database into the main server.

hope this helps

regards
Shouvik

choudhuryshouvi 33 Posting Pro

just write (in lst1_click() event) :-

lst2.listindex=lst1.listindex

choudhuryshouvi 33 Posting Pro

hi TORO it's Shouvik again. i think that is my code which i posted to ur previous thread. here is the answer for ur question :-

there is no error in the above code at all. all the syntaxes and calling procedures,functions are absolutely correct. the msgbox callout is also completely ok. u have the problem in the dao reference which u have forgotten to include into ur project.to add it goto project->references, scroll down and select "Microsoft DAO 3.51 Object Library" and click ok. after this run the program and there will be no error at all. it's a promise. and by the way thanks for ur comment for my reply to ur previous post. keep contacting me.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

what is data report?

first tell do u know what vb is???

choudhuryshouvi 33 Posting Pro

try the following code. before u try to run it create an access db(employee.mdb) under the same folder as ur project exists. in the db create a table(details) with three fields(id,name,basic). in the form take the following objects :-(see the interface screenshot)

Option Explicit

Dim db As Database
Dim rs As Recordset

Private Sub cmdsearch_Click()
If Trim(txtsearch.Text) <> "" Then
    Set rs = db.OpenRecordset("select * from details where id='" & Trim(txtsearch.Text) & "'")
    If rs.RecordCount > 0 Then
        txtid.Text = rs!id
        txtname.Text = rs!Name
        txtbasic.Text = rs!basic
        txtsearch.SelStart = 0
        txtsearch.SelLength = Len(Trim(txtsearch.Text))
        txtsearch.SetFocus
    Else
        MsgBox "Sorry, there is no such record found in the database with Employee ID :" & _
            Trim(txtsearch.Text) & "." & vbCrLf & "Please try again...", vbExclamation, "Employee"
        txtid.Text = ""
        txtname.Text = ""
        txtbasic.Text = ""
        txtsearch.SelStart = 0
        txtsearch.SelLength = Len(Trim(txtsearch.Text))
        txtsearch.SetFocus
    End If
Else
    MsgBox "Please mention the employee id to search for.", vbExclamation, "Employee"
    txtsearch.SetFocus
End If
End Sub

Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\employee.mdb")
Set rs = db.OpenRecordset("details", dbOpenTable)

If rs.RecordCount > 0 Then
    rs.MoveFirst
Else
    MsgBox "Please add some records to the database before you try to search.", vbInformation, "Employee"
End If
End Sub
choudhuryshouvi 33 Posting Pro

if u wish to call the cmdswing_click event from another event just call it under it. like if u want to call it in form_load event the syntax will be :-

private sub form_load()
call cmdswing_click
end sub

or if u wish to call the same event from an outside procedure declare the cmdswing_click event as public like this :-

public cmdswing_click()
<your code goes here>
end sub

now u can call the event from another form just like this :-
private sub form_load() 'this is form2
call form1.cmdswing_click
end sub

hope this will help
regards
Shouvik

choudhuryshouvi 33 Posting Pro

try the following code :-

take two labels(label1 and label2) and a textbox(Text1)
here the database ->"aa.mdb"
table ->"aa"
fields ->"id" (long,autonumber) ; "name" (text)

Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\aa.mdb;Persist Security Info=False"
conn.ConnectionString = str
conn.Open

str = "select * from aa where id = " & Val(Text1.Text)
rs.Open str, conn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
    Label1.Caption = rs!id
    Label2.Caption = rs!Name
Else
    MsgBox "No record found."
End If
Text1.Text = ""
Text1.SetFocus
choudhuryshouvi 33 Posting Pro

what are the requirements for ur project? what is the subject of ur project?

plz explain in detail.
BTW what did u wish to meant by "which software is the best to work on it"?

choudhuryshouvi 33 Posting Pro

Can a form have a different shape than just square or rectangle

check out this sample code in the attachment.
hope it will give you some idea.

choudhuryshouvi 33 Posting Pro

u need to use certain api function calls.
do a search in google or visit

http://www.planet-source-code.com

choudhuryshouvi 33 Posting Pro

u can accomplish this in two ways.

either u use

form1.show vbmodal

here form1 is form which will appear in front of the form which u wish to keep behind

or

form2.enabled=false

here form2 is the form which u wish to keep behind

otherwise u can use form2.hide

choudhuryshouvi 33 Posting Pro

check out this sample code :-

put a textbox(Text1) and a command button(Command1) on your form before u execute the following code. in the code, here "file1.txt" is the target file which i'm creating and sending different text at different time but instead of opening a new instance its closing the currently opened instance and opening a new notepad window.if u wish to modify the code,just change the name of the text file in the section where u find the term "file1.txt" and put ur filename.

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10

Private Sub Command1_Click()
Dim winHwnd As Long, RetVal As Long

If Dir(App.Path & "\file1.txt") = "" Then
    Open App.Path & "\file1.txt" For Output As #1
        Print #1, Text1.Text
    Close #1
    Shell "notepad.exe " & App.Path & "\file1.txt", vbNormalFocus
Else
    winHwnd = FindWindow(vbNullString, "file1 - Notepad")
    If winHwnd <> 0 Then
        RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
    End If
    Kill App.Path & "\file1.txt"
    Open App.Path & "\file1.txt" For Output As #1
        Print #1, Text1.Text
    Close #1
    Shell "notepad.exe " & App.Path & "\file1.txt", vbNormalFocus
End If
End Sub
choudhuryshouvi 33 Posting Pro

if u r using windows media player :-

the syntax is:-

mediaplayer1.filename=commondialog1.filename
mediaplayer1.play

if u r using microsoft multimedia control :-

the syntax is :-

multimedia1.filename=commondialog1.filename
multimedia1.command="open"
multimedia1.command="play"

hope this will help you.

regards
Shouvik

hawisme000 commented: helpfull +1
choudhuryshouvi 33 Posting Pro

check out this sample project.

choudhuryshouvi 33 Posting Pro

have u meant to create a multiuser login application where each user can create their profile and login by using those like various website does?

confirm it first...

choudhuryshouvi 33 Posting Pro

you can download the latest version of oracle(ora10g) from http://www.oracle.com(IT'S FREE) but be aware this could be of 2.0 gb in size(the downloadable file itself). just download and begin the installation process, the rest thing will be managed by the oracle installer itself. it will install the data provider which you can use to communicate with any oracle database and its associated tables,views,procedures,triggers etc from your vb6 apps.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

hello Butt Gee,
if you cannot be able to find the shortcuts there, that means your os or might be you accidentally deleted it. but don't worry there is an alternate way. try this...

1. within vb6 ide, click Add-Ins->Add-In Manager
2. there you will find package and deployment wizard in the available add-ins list. select that and check on the two options below under Load Behaviour which are "Loaded/Unloaded" and "Load on startup". click ok to save and exit this screen.
3. then click the add-in menu again
4. now you can see the option appeared under this menu.
5. after clicking this option if you fetch any error then consider that you need to re-install visual studio in your computer.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

In vb6 the form is treated like an object. But if you use the .net platform of vb then this becomes a standalone class. when we refer dim a as new form1, means we actually create a new object of the class form1 and simultaneously allocating memory to it. if wish to know more just visit http://msdn2.microsoft.com and search form windows forms in visual basic. you will find enourmous totorials,resources and articles there.

Always remember that the best alternative is to learn anything from the organization who has developed it.

choudhuryshouvi 33 Posting Pro

this is not at all a related topic to this forum. do not post absurd materials here. though i'm answering to your question. try the following sites:-

http://www.mp3hungama.com
http://www.bollyextreme.com
http://www.smashhits.com

remember my words

choudhuryshouvi 33 Posting Pro

use the following code :-

dim rs as new adodb.connection
dim str as string
dim conn as new adodb.connection

conn="<your db connection string>"

''the following becomes the query string to be passed to the recordset object
str="select * from student where roll_no in(10,20,30)"
rs.open str,conn,1,2       ''opening the recordset to fetch data from the student table

if rs.recordcount>0 then           ''some records found
       msgbox "record found."
else           ''no matched data found
       msgbox "the rollno supplied by you is not found in the specified values parsed into the query string."
endif

hope this will help you in some context.
regards
Shouvik

By the way what about your crystal report project? did you finish it?

choudhuryshouvi 33 Posting Pro

I am a beginner in Visual basic. I recenly was testing one of the applications I developed and have a problem to run it.

The application basicly is a database that I can add/remove/update...etc records and it uses a microsoft access database to connect to.

I have no problems in running it using visual basic but when I compile it and try to install it on a different computer
------------------------------------------------
------------------------------------------------
how I do that to make the app to run on other computer
The PC that I used to compile the appliction in vb6 & Ms Access installed in it. but end side the computer doesn't have Ms Access/vb6 installed!
some one say to make the setup files and install on end side nut no one`s how i make the setup/.exe file use vb6
p help me

ur query is already answered in the post "Problem in running application on another computer". so go and find it out.

choudhuryshouvi 33 Posting Pro

follow the following steps to create the installer for ur project. but before trying this make sure that u have created the executable(.exe) for ur project. hope u know how to create that.

1.close ms vb6.0 ide
2.click start>-programs->microsoft visual studio 6.0->microsoft visual studio 6.0 tools->package and deployment wizard
3.click browse to locate ur project file(.vbp)
4.click package
5.click yes to start the recompilation process
6.in package type select standard setup package and click next
7.select the destination where u want to create the package folder for ur project.this folder will contain all the supported and main application files required to install ur apps in some other client machine.
8.click yes to create the folder if it doesn't exist and click next
9.the next list that will come will display all necessary files to build the setup.click add to insert some other files from ur project to the said list.if u any access database file,click this button,locate ur db file and click open to add the file to the list.this list will also help u to remove any unnecessary files that u donot wish to install in the target machine with apps.u can also add help files(if any) for project from this option.but do not ever try to remove the .dll,.ocx,.lib or .exe files.click next
10.if u want ur setup becomes a standalone package select single cab otherwise if u want part installer then select multiple

choudhuryshouvi 33 Posting Pro

u have posted the thread in the wrong forum. post it in the vb.net forum after that ur question will be answered.

choudhuryshouvi 33 Posting Pro

the answer in the post #2 is correct. but there is another way. if u do not need a huge installing process then just install the vb6 runtime files on the target compuer along with ur apps. u can get the vb6.0 sp4 runtime files from http://www.microsoft.com

choudhuryshouvi 33 Posting Pro

there are so many possibilities for creating a simple project. which one do u prefer?

choudhuryshouvi 33 Posting Pro

have u copied the mscomctl.ocx file to ur system directory?

if yes then pass the following command to register the above ocx :-

if u use win9.x :
regsvr32 %systemroot%\system\mscomctl.ocx

if u use winxp :
regsvr32 %systemroot%\system32\mscomctl.ocx

then add the control from project->components

it should work now.

choudhuryshouvi 33 Posting Pro

we all know that's the result of ur hard work.but if u do not clearly state the problem how can somebody be able to figure this out?either u post the specific part where r u getting the error or completely describe the problem.

the other thing is, the version of the windows media player activex control is very much depended on the windows media player that u install in ur machine. by default when u install vs6.0 it installs the version 6.4 but if u install the microsoft windows media player externally(from any source)the version will be upgraded.if it happens u cannot be able to use the older version anymore.even if u used the old control in ur program, after the upgradation the existing control in ur program will not be recognized by the vb itself. then u can be able to run the executable only(if created). let's for example, u used wmp 6.4 ocx. now u installed wmp 10 in the same os. now if u try to run ur existing code u will fetch erros associated with the wmp control. these errors actually occur due to change in the methods and properties of the control in diff. versions. like if u wanna play a file using wmp 6.4 u code mediaplayer1.play, but if u use wmp 10 or some other higher version the equivalent syntax will be mediaplayer1.controls.play, so in this case after upgradation of the control the previous syntax will not be recognized by …

choudhuryshouvi 33 Posting Pro

post the code segment where u r getting the error. may be this error is occurring due to version confliction for the controls.r u using windows media player control 6.4(in xp) or installed the new version externally?

choudhuryshouvi 33 Posting Pro

if u r using the DAO technique use the table recordset type at the time of opening the recordset. a sample is :-

dim db as database,rs as recordset

set db=opendatabase(app.path & "\mydb.mdb")
set rs=db.openrecordset("table1",dbopentable)
if rs.recordcount>0 then
''ur data showing code goes here
endif

otherwise u have to simultaneously unload and show up ur forms.

choudhuryshouvi 33 Posting Pro

if ur intension is only to play the sound files, use windows media player control or windows multimedia control or in advance u can also use the "mcisendstring" api libraries.

choudhuryshouvi 33 Posting Pro

check out this sample code. this code intends to display all values of "name" field present in a table called "info" from an access database named "demo".

Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(App.Path & "\demo.mdb")
Set rs = db.OpenRecordset("info", dbOpenTable)
Combo1.Clear
Combo1.AddItem "<Select a Name>"
If rs.RecordCount > 0 Then
    rs.MoveFirst
    While Not rs.EOF()
        Combo1.AddItem rs!Name
        rs.MoveNext
    Wend
Else
    MsgBox "No data present in the table."
End If
Combo1.ListIndex = 0

here combo1 is the target control which is going to be filled up by the data of said column.

for ur consideration there is a screenshot below.check that out also.
for any more troubles u can meet me at choudhuryshouvik@yahoo.com

choudhuryshouvi 33 Posting Pro

check out this sample program.
don't forget to give your geedback.

choudhuryshouvi 33 Posting Pro

you have to install the sql server 2000 rdbms on the client machine along with your application. it is not possible to run your apps in the machine where sql is not installed as your apps will not access the databases and its associated tables. hope it will help you. but you can install them in any order.

choudhuryshouvi 33 Posting Pro

what syntax do you want to converted to ado? please clearly specify here.

choudhuryshouvi 33 Posting Pro

ok i've got it.
thanks for help all of you.

choudhuryshouvi 33 Posting Pro

how could u run a sql statement using such field which has no connection with the database?

choudhuryshouvi 33 Posting Pro

so simple.
jusy use the addition code two times.
first add in the master table and then add to the child.

choudhuryshouvi 33 Posting Pro

hi waynespangler i think this will close the entire application. but my question is to close only a single form and activate the parent.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

i've already used the suggested syntax.but it didn't work.

any other way plz...?

choudhuryshouvi 33 Posting Pro

well to perform the math you have to convert the droplist values into numbers.because they(droplist values) always come in string format.use the VAL function to do the conversion like :-

dim a,b as integer
a=val(trim(combo1.text))
b=val(trim(combo2.text))

after this you can perform any mathematical operations like :-

dim subs as integer,divd as double
subs=a-b
divd=round(a/b)

use the ROUND() to round up any values.
then u can display the output like :-

label1.caption="Substraction :" & subs
label2.caption="Division :" & divd

hope it'll help.
regards
Shouvik