Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


I dont understand there has to be an easy way to find what code is needed


I dont understand there has to be an easy way to find what code is...

Author
Message
BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129

ok I am trying to learn VB6 I Bought this book called learning VB6 I've followed the lesson in there and was able to produce the same result that the book says and I understand it but it never covered everything I want to learn and it never worked on databasing I am interested in learning database and the many codes that are involved

So I went out to learn Database through eliminating the things that doesnt work and now I have ran out of ideas I realy dont know what I am doing

I have sat down and thought about what I would like my program to do scetched out what I want it to look like and have laid out my form accordingly I have add the code to place all the items in my list box but that as far as I have been able to get working right now I went from that straight to trying to code a comand button which I am calling my save button

this is where I lost myself to the black hole to never return I am stumped and fixated and cannot be budged from this

here where I will apoligise to you all  "I AM SO SORRY for what comes next"

the listbox I mention before has all the states of the united states in when I hilight a state in the listbox I want it to atomaticly search the database for that state that page in the database will contain a total amount of all the things

State tax withholding, total gross income, Field Dues, and of course the fed tax withholding but the fed thing is not nesseary as I can add it somewhere else as it is not state conditional.

most the textboxes I have on the form it state conditional I want to enter these amount I mentioned in the textboxes on a weekly bases from my paystubs when I have entered the all that I want to press the save button  I want the amounts to be added to that state selected database

 I know I Know and as I said I am so sorry but I am realy hung up on this so does any one have a pill for this

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com

Mark
Mark
Forum God
Forum God (144K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
I have read it a couple times and I'm not sure I have it yet. Let me know if I'm on track here.

Okay, you have a listbox that allows you to select a state.

When you select a state it brings up a form. Depending what state you pick determines what fields will be available. If this is correct, how do you determine which fields to show?

When the form comes up will it be prepopulated with data for that state?

You mentioned saving data. Will this be added (summed) to an existing record or will it create it's own new record?

Your best bet for help on something like this is to post the entire project including database and try working out one problem at a time.

BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
Mark (2/18/2009)
I have read it a couple times and I'm not sure I have it yet. Let me know if I'm on track here.

I am Sorry about that...

Okay, you have a listbox that allows you to select a state.

When you select a state it brings up a form. Depending what state you pick determines what fields will be available. If this is correct, how do you determine which fields to show?

No I dont need the form to bring anything up but more for my program to just know its there in the back ground

When the form comes up will it be prepopulated with data for that state?

well at first all the states will be empty untill I enter it

You mentioned saving data. Will this be added (summed) to an existing record or will it create it's own new record?

it will be summed to an existing record


Your best bet for help on something like this is to post the entire project including database and try working out one problem at a time.

not sure how to do that would be great to do so I agree but at the same time I dont want it to be worked all out for me

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com

BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
Ok I realy dont have anything to say here just doing this to add this to my subscriptions

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com
Mark
Mark
Forum God
Forum God (144K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
Ok, lets take it a step at a time. What is the first problem you are having, what code are you using, what is the code doing and what do you want the code to do?
BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
ok the code is the first problem i am having I tried to use the if function but was unsure how to write it.

well lets pull apart what I want it to do

the first thing I guess is that I need the listbox to recognise that I have a database for it to look at and what part of the database it needs to consintrate on

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com

Edited
2/19/2009 by BuzzL30
BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
Well I have some screeshots to display both me VB form and my database

the database is real basic nothing fancy as i wont be seeing it much anyway but I dont know if the setup on it is correct or not I have tried it out and it works although I need to do some changes to it such as the main sorting info on it like right now it is giving the contractors name the id key for uniqueness and I want the state to have the sorting uniqueness I think to be able to add together all the amount from different conractors in the same state

but I am sure I can do this by myself

I just want to learn what code in VB will do what I want it to do from above

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com

BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
screenshot 02 is the screen shot where the mouse pointer is at that is my state listbox

screenshot03 where the pointer is that is my save button

and screenshot 04 that is my database

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com

Mark
Mark
Forum God
Forum God (144K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
OK I don't even know if I'm starting in the right place for you or not. From you screen shots it appears that it is going to be possible for there to be multiple enteries for the same state. Since you haven't attached your project or database I'm giving you an example using the northwinds database that you may have installed along with the VB help files. Since I couldn't find a state field in the database I will use the country field in the customers table and will load the unique countries from that table into a listbox. There should be very little needed in the code below to make it work for your project.

Option Explicit
'Set a reference to one of the
'Microsoft ActiveX Data Object 2.x Library
Dim ConnString As String

Private Sub Form_Load()
    'Adjust connections string to match your database. Probably all you need to do is change the path
    ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB"
    
    LoadStates
End Sub


Private Sub LoadStates()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String

    'Create and open the connection object
    Set cn = New ADODB.Connection
    cn.ConnectionString = ConnString
    cn.Open
    
    'Need to change the SQL to pull state from your table
    strSQL = "SELECT DISTINCT(Country) FROM Customers Order By Country"
    
    'Create a recordset with all the countries
    Set rs = New ADODB.Recordset
    With rs
        .ActiveConnection = cn
        .CursorLocation = adUseServer
        .CursorType = adOpenForwardOnly
        .LockType = adLockReadOnly
        .Source = strSQL
        .Open
    End With
    
    'Check that records have been returned
    If Not (rs.EOF And rs.BOF) Then
        'load the listbox with the countries
        List1.Clear
        Do While Not rs.EOF
            List1.AddItem rs!country '<-- Make sure to update the field here
            rs.MoveNext
        Loop
    End If
    
    'Clean up
    If Not rs Is Nothing Then
        If rs.State = 1 Then
            rs.Close
        End If
        Set rs = Nothing
    End If
        
    If Not cn Is Nothing Then
        If cn.State = 1 Then
            cn.Close
        End If
        Set cn = Nothing
    End If
End Sub

BuzzL30
BuzzL30
Forum God
Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)Forum God (8.6K reputation)

Group: Forum Members
Posts: 31, Visits: 129
Ok thanks I will check that out  in a bit and I am going to try to get a zip of the program and database up on here sometime today if you want you could im me on yahoo or call me

 Hey looking for a puppy check out what we have www.kaycopets.com" target=_"blank" class="SmlLinks">www.kaycopets.com
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search