Vulcan1500
Registered User.
- Local time
- Today, 04:12
- Joined
- Nov 13, 2007
- Messages
- 143
The problem is: When I delete all the records in the table 'Invoice' then the option group of the form does not show up. I have no idea why. As far as I know there is no reason that an empty 'invoice' table should influence the option group. Can on of you help me?
I'm using already some time my database in MS Access 2003 for invoicing purposes. Front and backend are separated. From the menu I can push a button and a form opens, which gives me 4 options to select the paper to print the invoice (e.g. blanc, pre-printed, ...) on. Either the default option or the by the user selected option is stored in a table in the frontend for future use. The code in the 'on open event' of the form is:
The code of the function TableExists is as follows:
Normal form and blanc form are attached.
I'm using already some time my database in MS Access 2003 for invoicing purposes. Front and backend are separated. From the menu I can push a button and a form opens, which gives me 4 options to select the paper to print the invoice (e.g. blanc, pre-printed, ...) on. Either the default option or the by the user selected option is stored in a table in the frontend for future use. The code in the 'on open event' of the form is:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim db As DAO.Database
Dim td As DAO.TableDef
Dim fld As DAO.Field
Dim rs As DAO.Recordset
Set db = CurrentDb()
If TableExists("EigenaarDruktAfOp") Then
Set rs = db.OpenRecordset("EigenaarDruktAfOp")
optAfdrukkenOp = Nz(rs("AfdrukkenOp").Value, "")
Else
optAfdrukkenOp = 1
'create table EigenaarDruktAfOp with field AdrukkenOp
Set td = db.CreateTableDef("EigenaarDruktAfOp")
With td
Set fld = .CreateField("AfdrukkenOp", dbSingle)
.Fields.Append fld
End With
db.TableDefs.Append td
'store optAfdrukkenOp
Set rs = db.OpenRecordset("EigenaarDruktAfOp")
rs.AddNew
rs!AfdrukkenOp = optAfdrukkenOp
rs.Update
End If
rs.Close
db.Close
Set rs = Nothing
Set fld = Nothing
Set td = Nothing
Set db = Nothing
End Sub
The code of the function TableExists is as follows:
Code:
Public Function TableExists(TableName As String) As Boolean
Public Function TableExists(TableName As String) As Boolean
'Checks for the existence of a table and returns true if table exists
Dim db As DAO.Database
Dim td As DAO.TableDef
TableExists = False
Set db = CurrentDb
For Each td In db.TableDefs
If td.Name = TableName Then
TableExists = True
Exit Function
End If
Next td
End Function
Normal form and blanc form are attached.