Adding Record problems with Status Bar 
Author Message
 Adding Record problems with Status Bar

Hey everyone

I was wondering if someone could help me with a problem that I am having
with adding a record to a recordset, and using a status bar to tell how
many records there are.

Here is the code that I have:

Sub AddRecord()

    ' Open the recordset as a variable so that you can add new
    ' records to the database
    Dim db As Database, Rs As Recordset
    Set db = Workspaces(0).OpenDatabase("workorder.mdb")
    Set Rs = db.OpenRecordset("workorders") ' Defaults to Table object.
    Set frmWorkOrder.WOData1.Recordset = Rs   ' Assign Recordset.
    ' Add the record, and update the changes
    frmWorkOrder.WOData1.Recordset.AddNew
    frmWorkOrder.WOData1.Recordset.Update

    ' Update the Status Bar panels
    frmWorkOrder.StatusBar1.Panels(1).Text =
frmWorkOrder.WOData1.Recordset.AbsolutePosition + "\" +
frmWorkOrder.WOData1.Recordset.RecordCount
    frmWorkOrder.StatusBar1.Panels(8).Text = frmWorkOrder.txtName.Text
End Sub

What my problem is that when I add the record up pops this message:

Run-time error '3251':

Operation is not supported for this type of object

And then proceeds to highlight the 3rd last line, where it shows how
many records there are. I was wondering why it was doing that, and if
someone could help me solve my little problem that I have.

Any help would be greatly appreciated.
Thanks,

Adam



Fri, 02 Nov 2001 03:00:00 GMT  
 Adding Record problems with Status Bar
Did you try using "&" in place of "+", I think it's trying to do a
calculation when you want it to build a string.

I think the backward slash is a way of dividing numbers where it returns a
whole number without any decimals. so your statement is getting confused as
an equation that would look like "56+\+22"

Quote:

>Hey everyone

>I was wondering if someone could help me with a problem that I am having
>with adding a record to a recordset, and using a status bar to tell how
>many records there are.

>Here is the code that I have:

>Sub AddRecord()

>    ' Open the recordset as a variable so that you can add new
>    ' records to the database
>    Dim db As Database, Rs As Recordset
>    Set db = Workspaces(0).OpenDatabase("workorder.mdb")
>    Set Rs = db.OpenRecordset("workorders") ' Defaults to Table object.
>    Set frmWorkOrder.WOData1.Recordset = Rs   ' Assign Recordset.
>    ' Add the record, and update the changes
>    frmWorkOrder.WOData1.Recordset.AddNew
>    frmWorkOrder.WOData1.Recordset.Update

>    ' Update the Status Bar panels
>    frmWorkOrder.StatusBar1.Panels(1).Text =
>frmWorkOrder.WOData1.Recordset.AbsolutePosition + "\" +
>frmWorkOrder.WOData1.Recordset.RecordCount
>    frmWorkOrder.StatusBar1.Panels(8).Text = frmWorkOrder.txtName.Text
>End Sub

>What my problem is that when I add the record up pops this message:

>Run-time error '3251':

>Operation is not supported for this type of object

>And then proceeds to highlight the 3rd last line, where it shows how
>many records there are. I was wondering why it was doing that, and if
>someone could help me solve my little problem that I have.

>Any help would be greatly appreciated.
>Thanks,

>Adam



Mon, 05 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB5: Adding Progress Bar To Status Bar Panel?

2. Adding a Progress Bar to a Status Bar panel

3. Adding a Progress Bar to the Status Bar

4. Adding Progress Bar onto Status Bar

5. add status bar

6. Add ProgressBar object into status bar

7. # Records processed in Crystal Status Bar

8. Number of records processed on crystal status bar

9. CapsLock & Numlock status in Status Bar Panels

10. Status Bar Insert Panel reports the wrong status

11. Status Bar Problem

12. Status bar problem

 

 
Powered by phpBB® Forum Software