My first database program

My first database program

Post by Peter » Sat, 28 Apr 2001 05:32:20



I am new to VB and I am trying to develop a simple program:

I have an access database called Client with a table called client
that has 3 rows ID, NAME, and ADDRESS.
My VB project has a simple form that contains 2 labels, and an ADO datacombo
box. I have the datacombo linked to the ID and I now want my labels to
change to the appropriate name and address when I change the ID.
I seem to have run into a stand still..I can not get the labels to
change/update when I select a different ID.. is there an after update event?
should I be using a on change event?? I really have exhausted all my ideas
so I must ask for assistance.. an example would by the ultimate or
direction..show me the way

pete

 
 
 

My first database program

Post by Dave Flower » Sat, 28 Apr 2001 14:05:14


You can use the Combo1_Change() event.
Sample:

Private Sub Combo1_Change
    Label1.Caption = Data1.Recordset!Name
    Label2.Caption = Data1.Recordset!Address
End Sub

When you change the row in the combo, you also change the row in the
database so each column ID, Name, and Address are the current record.

You could also link each label to the data control and field in the
properties window.
Label1.DataSource = Data1
Label1.DataField = Name

Dave


Quote:> I am new to VB and I am trying to develop a simple program:

> I have an access database called Client with a table called client
> that has 3 rows ID, NAME, and ADDRESS.
> My VB project has a simple form that contains 2 labels, and an ADO
datacombo
> box. I have the datacombo linked to the ID and I now want my labels to
> change to the appropriate name and address when I change the ID.
> I seem to have run into a stand still..I can not get the labels to
> change/update when I select a different ID.. is there an after update
event?
> should I be using a on change event?? I really have exhausted all my ideas
> so I must ask for assistance.. an example would by the ultimate or
> direction..show me the way

> pete


 
 
 

My first database program

Post by Peter » Sat, 28 Apr 2001 22:20:04


Dave
AHHH... I did say I was a newbie =] ...one more question, how do you
translate the ! that is used after RecordSet?
Label1.Caption = Data1.Recordset!Name
I do appreciate your time!
Peter


> You can use the Combo1_Change() event.
> Sample:

> Private Sub Combo1_Change
>     Label1.Caption = Data1.Recordset!Name
>     Label2.Caption = Data1.Recordset!Address
> End Sub

> When you change the row in the combo, you also change the row in the
> database so each column ID, Name, and Address are the current record.

> You could also link each label to the data control and field in the
> properties window.
> Label1.DataSource = Data1
> Label1.DataField = Name

> Dave



> > I am new to VB and I am trying to develop a simple program:

> > I have an access database called Client with a table called client
> > that has 3 rows ID, NAME, and ADDRESS.
> > My VB project has a simple form that contains 2 labels, and an ADO
> datacombo
> > box. I have the datacombo linked to the ID and I now want my labels to
> > change to the appropriate name and address when I change the ID.
> > I seem to have run into a stand still..I can not get the labels to
> > change/update when I select a different ID.. is there an after update
> event?
> > should I be using a on change event?? I really have exhausted all my
ideas
> > so I must ask for assistance.. an example would by the ultimate or
> > direction..show me the way

> > pete

 
 
 

1. A question about First Choice database program

I have been using First Choice database program for many years.
One of my folders has about 2000 records. For some reason now whenever I
try to retrieve one particular record the message comes" Database error: -3
Escape to cancel". I do not know how to correct this problem. If I try to
retrieve a group of records this again happens if this particular record is
a part of the whole record that I am trying to retrieve. It took me many
years to make this database. I would be thankful if somebody would post me
any suggestions to my e-mail address rather than to the newsgroup.

Also I would like to transfer this folder to Works database program if it
is possible to do so.

I would like to speak with somebody from First Choice  but I do not have
their address or phone number.

Thanks in advance for your help.

Khalid R.Siddiqui, MD

2. Updating one table with values from another

3. HELP: First Embedded SQL program (C)

4. Handling ^M's in text files

5. Help! Stuck on first ADO Program

6. OPAL question re: movement between objects in forms

7. Breadth-first search crawler program

8. Locking Messages in LOG File

9. Programming Informix SQL/$GL, Cathy Kipp, first edition examples code

10. Compiling first ADO program...a few errors

11. First time DB program, need help

12. FPW 2.6: Device not ready error when first entering program

13. PRG HELP - First-time FoxPro program