ilikemyfto
Registered User.
- Local time
- Today, 07:52
- Joined
- Sep 11, 2003
- Messages
- 11
This is driving me bonkers.
I have a replicated database and when I create a replica from the Design Master I get a message saying Msaccess.exe has generated errors... when I open the replica, but only on the first load.
I have traced it to a point where I create a local table with the replica. If I run the code from the replica it gives a fail on the first attempt but subsequent runs are ok. Sure the code recognises if the table has been already created and if so drops out. I have tried including a brakepoint but the fail drops the code out of Access.
The jet engine is at the lastest level for Win 2000.
I'm stumped, anyone a bright idea!
KR
Source Code:-
Function CreateCurrentUserTable()
On Error GoTo CreateOrdersTable_Err
' From Access 97 Developer's Handbook
' by Litwin, Getz, and Gilbert (Sybex)
' Copyright 1997. All rights reserved.
'Note this table is not in the Replicated Set
Dim db As Database
Dim CurrentUser As TableDef
Dim fld1 As Field
Dim fld2 As Field
Dim fld3 As Field
Dim fld4 As Field
Dim fld5 As Field
Dim IntAnswer As Integer
Dim strmsg As String
Set db = CurrentDb()
Set CurrentUser = db.CreateTableDef()
CurrentUser.Name = "CurrentUser"
Set fld1 = CurrentUser.CreateField("CurrentUserID", dbLong)
Set fld2 = CurrentUser.CreateField("CurrentUser", dbText, 30)
Set fld3 = CurrentUser.CreateField("Username", dbText, 30)
Set fld4 = CurrentUser.CreateField("LastModTime", dbDate, 30)
Set fld5 = CurrentUser.CreateField("LastModUser", dbText, 30)
With CurrentUser.Fields
.Append fld1
.Append fld2
.Append fld3
.Append fld4
.Append fld5
End With
With db.TableDefs
.Append CurrentUser
.Refresh
End With
Application.RefreshDatabaseWindow
CreateOrdersTable_Exit:
Exit Function
CreateOrdersTable_Err:
'MsgBox Error$
If (Err = 3010) Then
Resume CreateOrdersTable_Exit
Else
strmsg = "An Unecpected Error has Occured " & Err
IntAnswer = MsgBox(strmsg, vbCritical + vbOKOnly)
Resume CreateOrdersTable_Exit
End If
End Function
I have a replicated database and when I create a replica from the Design Master I get a message saying Msaccess.exe has generated errors... when I open the replica, but only on the first load.
I have traced it to a point where I create a local table with the replica. If I run the code from the replica it gives a fail on the first attempt but subsequent runs are ok. Sure the code recognises if the table has been already created and if so drops out. I have tried including a brakepoint but the fail drops the code out of Access.
The jet engine is at the lastest level for Win 2000.
I'm stumped, anyone a bright idea!
KR
Source Code:-
Function CreateCurrentUserTable()
On Error GoTo CreateOrdersTable_Err
' From Access 97 Developer's Handbook
' by Litwin, Getz, and Gilbert (Sybex)
' Copyright 1997. All rights reserved.
'Note this table is not in the Replicated Set
Dim db As Database
Dim CurrentUser As TableDef
Dim fld1 As Field
Dim fld2 As Field
Dim fld3 As Field
Dim fld4 As Field
Dim fld5 As Field
Dim IntAnswer As Integer
Dim strmsg As String
Set db = CurrentDb()
Set CurrentUser = db.CreateTableDef()
CurrentUser.Name = "CurrentUser"
Set fld1 = CurrentUser.CreateField("CurrentUserID", dbLong)
Set fld2 = CurrentUser.CreateField("CurrentUser", dbText, 30)
Set fld3 = CurrentUser.CreateField("Username", dbText, 30)
Set fld4 = CurrentUser.CreateField("LastModTime", dbDate, 30)
Set fld5 = CurrentUser.CreateField("LastModUser", dbText, 30)
With CurrentUser.Fields
.Append fld1
.Append fld2
.Append fld3
.Append fld4
.Append fld5
End With
With db.TableDefs
.Append CurrentUser
.Refresh
End With
Application.RefreshDatabaseWindow
CreateOrdersTable_Exit:
Exit Function
CreateOrdersTable_Err:
'MsgBox Error$
If (Err = 3010) Then
Resume CreateOrdersTable_Exit
Else
strmsg = "An Unecpected Error has Occured " & Err
IntAnswer = MsgBox(strmsg, vbCritical + vbOKOnly)
Resume CreateOrdersTable_Exit
End If
End Function