Dataform wizard problem

S

Sam

Hello Everyone,

I used the dataform wizard to create a form based on a table. When I press
the load button it shows 3 of 3 records but I can not let it ever pass the
2nd record. When I press the next button on record 2 it stays there. I've
done this before and never had a problem. It is a simple employee table
with nothing special about it. Usual primary key and fields.In fact I was
able to make a data grid view on another form that works fine. Any ideas?
Anyone experience this before.


Thanks ahead of time
 
C

CT

Not sure what is happening, but did it ever work? If so, will recreating the
form work? Do you have any custom code in the form? If so, what is it?
 
C

Cor Ligthert [MVP]

Sam,

Are you sure you want to use this, my expirience is that it is hard to
maintenance.
(By every change you have to recreate it almost forever new)

Just a warning nothing more.

Cor
 
S

Sam

Hey guys,

Thanks guys for the suggestions. I figured it out. It turns out that if you
have a checkbox in the form it causes a problem. Checkboxes don't handle
nulls too well. I had to put the following code in the form constructor to
make a default for the checkbox so when it comes time to select the record
there is a value that the checkbox can expect from the dataset.

InitializeComponent();

objdsEmployeeRecord.Tables["employee"].Columns["employee_hidden"].DefaultVal
ue = false;

Basically we are modifying the dataset before the checkbox has a chance to
see that it is null. If anyone has a problem with checkboxes with nulls or
any other fields that don't allow you to see the records its probably due to
nulls not being accepted by the component.

I also had a problem with datetime (getdate()) database defaults not showing
up as soon as I create records in the database. This problem drove me crazy
and I thought I'd add it to this post. Whats happening with the
oledbinsertcommand before the following modification is that a blank record
is being inserted for all fields. As you all know if blanks are inserted
then the defaults will not be inserted. So we have to force the default
values upon the insert of the form.

I had to edit the command text of the oledbinsertcommand to the following
(note the isnull has a getdate):

INSERT INTO employee
(employee_employeeaddress, employee_employeeapt,
employee_employeecity, employee_employeestate, employee_employeezip,
employee_employeehomephone,
employee_employeeworkphone, employee_employeedatehired,
employee_employeenotes, employee_hidden,
employee_employee_id_old, employee_employeefirstname,
employee_employeelastname, employee_employeeusername,
employee_employeestatus, employee_employeepassword,
employee_employeeovertimewage, employee_employeeregularwage,
employee_created_tm, employee_modified_tm,
employee_employeestatusdate, employee_employeedateterminated,
employee_employeesocialsecurity,
employee_employeemobilephone)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, isnull(?,
getdate()), isnull(?, getdate()), ?, ?, ?, ?);

Thanks,

Samer Abdullah

Just as a note for anyone
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top