Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

ms access - bind checkbox with a bit column in a SQL Server linked table

I'm trying to bind a checkbox with a bit column in a SQL Server linked table.

I had an error about the type at first, then I went in my linked table in access and changed the display control of the column to checkbox instead of textbox.

Now I have a write conflict error when I save the record.

enter image description here

I tried the solution about adding a timestamps in the table but I got the same problem

Is it possible without VBA?

Thank you

The code of my save button

Private Sub btnSave_Click()
  On Error GoTo Err_btnSave_Click
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      DoCmd.Close
  Exit_btnSave_Click:
      Exit Sub

  Err_btnSave_Click:
      MsgBox Err.Description
      Resume Exit_btnSave_Click

End Sub

I don't think there's anything wrong there. I got the error only when there's a checkbox bound to a bit column

I tried to bound a textbox to the same column. The value is false by default and I don't have the error if I don't change is value.

but when the form is dirty, even if I change the value of an another control, I got the error.

I don't understand. It's like if Access doesn't understand that there's only one user when there's a control bound to a bit column.

The last time I had this problem, I gave up and I change the type for a small int but I'm curious. Is there a way to make it worth with a Bit. all I want is a Boolean.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check if the bit field in SQL server is nullable. If it is, make it non-null and set the default value in SQL server to 0 (false). There is a discussion of this issue with nullable bit fields here: Nullable bool fields in MS Access linked tables


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...