Its about visual basic.
I am making an application for loan system..
I don't know whats the code.
It goes like this, the situation is:
* Count how many times does the CO-Maker grant already a loan.

Need help for this.

Going to need a whole lot more information than that to be able to figure out something! What code do you have so far?

Good Luck

>> I don't know whats the code.

so it is difficult to help you. take a help from any search engine.

Edited 6 Years Ago by abu taher: n/a

This is assuming (TMOAF) that you are saving every loan approved by a user/CO Maker in a database, you can get its recordcount as such -

Rs.Open "SELECT COMAKER FROM LoansApproved WHERE COMAKER = shaileqs90"

Text1.Text = Rs.Recordcount

'LoansApproved will be your database name and COMAKER will be the user that approved the loan.

Is this what you were looking for?

This is assuming (TMOAF) that you are saving every loan approved by a user/CO Maker in a database, you can get its recordcount as such -

Rs.Open "SELECT COMAKER FROM LoansApproved WHERE COMAKER = shaileqs90"

Text1.Text = Rs.Recordcount

'LoansApproved will be your database name and COMAKER will be the user that approved the loan.

Is this what you were looking for?

Thanks for the reply..let me emphasized clearly.. i can't get the right code for this situation.
When a user process new loan for that person, there is also a co-maker (CoMakerNo - field on the table in the database).. this means that the co-maker has granted already 1 applicant/person..

for the next process of loan, with the same co-maker, this means that the particular co-maker has granted already 2 applicants and so on and so fort..

help me please..it would be much appreciated..thanks

The way this site works is
1) You ask a specific question that can be answered.
2) You post the code segment that you are working on that doesn't work
3) You explain what it's doing wrong
4) You explain what it should be doing
5) Add any additional details that will help those if us that didn't write the code understand the code and the task.

don't know if this is right..

cn.Execute "Select * from tblMaker where CoMakerNo = " & cboid.text

With rs
.AddNew
.Fields("CoMakerNo").Value = Me.cboid.Text
.Fields("Name").Value = Me.txtname.Text
.Fields("NoApplicant").Value = Val(rs.Fields("NoApplicant").Value + 1)
.Update
End With

cn.Execute should be rs.open source, active connection, cursor type, lock type, options where...

source = "select *..."
active connection = cn
cursor type = [see help for this enum]
lock type = [see help]
options = optional parameter ususally left off

Good Luck

cn.Execute should be rs.open source, active connection, cursor type, lock type, options where...

source = "select *..."
active connection = cn
cursor type = [see help for this enum]
lock type = [see help]
options = optional parameter ususally left off

Good Luck

do you know the exact code for this situation..
i wrote the situation above..

:(

in the code window, type in Dim rs As ADODB.Recordset and press F1. When the dialog comes up, select the VB one and the help file will tell you all the options and their meanings. Its a quick enough read...

Good Luck

Do you want people to do the whole lot for you?

If you want help at least try and be more specific about the problem.

Hi,
I am also not sure if I can help you. vb5prgrmr and others mean to say that your code should be like

'Connect to DB
Dim CON As ADODB.Connection
Dim CMD As ADODB.Command
Dim RST As New ADODB.RecordSet
Dim conString As String
    
        conString = "DBQ=" & App.Path & "\Database.mdb" & "; Driver={Microsoft Access Driver (*.mdb)};"
    Set CON = New ADODB.Connection
    With CON
        .ConnectionString = conString
        .Open
    End With
Dim strSQL As String
    
    strSQL = "Select * from tblMaker where CoMakerNo = '" & cboid.text & "'"
    RST.Open strSQL, CON, adOpenForwardOnly, adLockOptimistic
'perform task if record.Eof is false    
If Not RST.EOF Then
With RST
.AddNew
.Fields("CoMakerNo").Value = Me.cboid.Text
.Fields("Name").Value = Me.txtname.Text
.Fields("NoApplicant").Value = Val(rs.Fields("NoApplicant").Value + 1)
.Update
End With
End If
'will disconnect from Database
    Set CMD = Nothing
    
    CON.Close
    Set CON = Nothing

Thanks

Edited 6 Years Ago by kinwang2009: n/a

This article has been dead for over six months. Start a new discussion instead.