Unbound forms

  • Thread starter Thread starter Latif
  • Start date Start date
L

Latif

How to develop a code for an unbound form which
iserts/update/delete and display a tabels record.

The for has three buttons one for insert one for update
one for delte and one for find.

What will be the code for each button
 
An unbound form requires significantly more coding, usually using DAO or ADO
to open recordsets and manipulate the data. Does it abolutely need to be
unbound?

I have found that opening a form for a single record is far easier
especially where a lot of fields of data need to be manipulated. I usually
set the form record source to blank and then set this property at startup
using a sql string in code. Rather than using the open with filter method I
open a form passing the record ID as an open argument. Also set the form
properties to not allow deletions, filters or additions. You can change the
additions setting in code for new records

Here is some air code. It is surely bad but will give you and idea.

Private Sub Form_Open()

If IsNull(Me.OpenArgs) Then
MsgBox "Cannot open."
DoCmd.Close
Else
Select Case Me.OpenArgs
Case "New"
Me.Form.AllowAdditions = true
Me.Form.DataEntry = true
Case IsNumeric
Me.Form.RecordSource = "SELECT Customers.* From Customers " _
& "WEHRE Customers.CustomerID = " & Me.OpenArgs
End select
End If

End Sub

If that doesn't work for you situation let me know.

Tony Vrolyk
 
Back
Top