DateTime Picker anomaly - please help 
Author Message
 DateTime Picker anomaly - please help

Hi Folks,

I have a Date/Time Picker and an ADO Data Control on a form.

The data control is bound to an Access database, that has a table with a
date field.
The Date/Time Picker is bound to the ADO Data Control.

If there is at least 1 record in the Access table, the form loads just fine.
If the table is empty (0 records), I get the following error message:
"Unable to bind to field or DataMember: 'S_DateOfBirth'."

My app starts off with an empty table, which the user will add to using my
app.

I want to use the Date Picker but an error must not occur if there are no
records in the table.
Is there a way around this anomaly?

Regards,
AHP



Sun, 01 Sep 2002 03:00:00 GMT  
 DateTime Picker anomaly - please help
If you have an error handler local in the form, you can trap and ignore the
message, yes??

--Charles


Quote:
> Hi Folks,

> I have a Date/Time Picker and an ADO Data Control on a form.

> The data control is bound to an Access database, that has a table with a
> date field.
> The Date/Time Picker is bound to the ADO Data Control.

> If there is at least 1 record in the Access table, the form loads just
fine.
> If the table is empty (0 records), I get the following error message:
> "Unable to bind to field or DataMember: 'S_DateOfBirth'."

> My app starts off with an empty table, which the user will add to using my
> app.

> I want to use the Date Picker but an error must not occur if there are no
> records in the table.
> Is there a way around this anomaly?

> Regards,
> AHP



Tue, 03 Sep 2002 03:00:00 GMT  
 DateTime Picker anomaly - please help
What Charles said is good.  You can also bind to the ADO data control at
Form_Load dynamically after verifying that there are records, ie. do a
count. If none are returned, then you can leave the date control DataField
empty and unbound. Otherwise, link it.

Russ E.R.
Data Management Consultants


Quote:
> Hi Folks,

> I have a Date/Time Picker and an ADO Data Control on a form.

> The data control is bound to an Access database, that has a table with a
> date field.
> The Date/Time Picker is bound to the ADO Data Control.

> If there is at least 1 record in the Access table, the form loads just
fine.
> If the table is empty (0 records), I get the following error message:
> "Unable to bind to field or DataMember: 'S_DateOfBirth'."

> My app starts off with an empty table, which the user will add to using my
> app.

> I want to use the Date Picker but an error must not occur if there are no
> records in the table.
> Is there a way around this anomaly?

> Regards,
> AHP



Tue, 03 Sep 2002 03:00:00 GMT  
 DateTime Picker anomaly - please help
In fact I can't trap this message. The message pops up even before the form
initializes, activates, loads, paints,....

I have (sort of) worked around the problem by using the following code
(thanks to E.R. Russ for his suggestion):

Private Sub Form_Load()
    On Error GoTo errHandler
    If Adodc1.Recordset.RecordCount > 0 Then
        DTPicker1.DataField = "S_DateOfBirth"
    End If
errHandler:
    'error handling code goes here
    Resume Next
End Sub

I still think it's cheating though, as the MonthView control doesn't give
any problems under the same circumstance. It's a pity the MonthView control
is not the appropriate control in this circumstance.

The other "cheat" I thought of, is to ship the app with a dummy record, and
then delete the dummy record once the user has entered a new record.

---Adam.
PS. It's time to fix this AHP nonsense - the company's got a spam filter at
last!


Quote:
> If you have an error handler local in the form, you can trap and ignore
the
> message, yes??

> --Charles



> > Hi Folks,

> > I have a Date/Time Picker and an ADO Data Control on a form.

> > The data control is bound to an Access database, that has a table with a
> > date field.
> > The Date/Time Picker is bound to the ADO Data Control.

> > If there is at least 1 record in the Access table, the form loads just
> fine.
> > If the table is empty (0 records), I get the following error message:
> > "Unable to bind to field or DataMember: 'S_DateOfBirth'."

> > My app starts off with an empty table, which the user will add to using
my
> > app.

> > I want to use the Date Picker but an error must not occur if there are
no
> > records in the table.
> > Is there a way around this anomaly?

> > Regards,
> > AHP



Fri, 06 Sep 2002 03:00:00 GMT  
 DateTime Picker anomaly - please help
On Error Resume Next


Fri, 06 Sep 2002 03:00:00 GMT  
 DateTime Picker anomaly - please help
The reason for the error message is because the datepicker does not have a
checkbox and so wont store nulls.

The error will occur whenever there is no record or you are adding a record
and haven't set the field value yet.

To stop the error just set the checkbox property to TRUE so that the control
will accept nulls or use a dataformat that formats nulls into a valid date.

Error handlers won't stop the message as the error is not being caused by
your code.

Hope this helps
Chris

Quote:
> Hi Folks,

> I have a Date/Time Picker and an ADO Data Control on a form.

> The data control is bound to an Access database, that has a table with a
> date field.
> The Date/Time Picker is bound to the ADO Data Control.

> If there is at least 1 record in the Access table, the form loads just
fine.
> If the table is empty (0 records), I get the following error message:
> "Unable to bind to field or DataMember: 'S_DateOfBirth'."

> My app starts off with an empty table, which the user will add to using my
> app.

> I want to use the Date Picker but an error must not occur if there are no
> records in the table.
> Is there a way around this anomaly?

> Regards,
> AHP



Sat, 21 Sep 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. DateTime Picker anomaly - please help

2. Help: DateTime Picker

3. Help On DateTime Picker

4. Help On DateTime Picker

5. Date/Time Picker Anomaly

6. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

7. MSCOMCT2.OCX and DateTime Picker control problem

8. DateTime Picker BorderStyle

9. datetime picker return type, changing time

10. DateTime Picker

11. Another problem with the DateTime picker

12. Datetime picker control in VB5

 

 
Powered by phpBB® Forum Software