TraceSL
Registered User.
- Local time
- Today, 07:40
- Joined
- Sep 12, 2017
- Messages
- 51
Hello
The macro I wrote is not working so I am back to using the VBA code.
Here is the full code I have embedded on the form property OnLoad.
It appears the code is not recognizing the two tables and field names I have defined in the string.
Also I already have code for this event so do I rename form_load unique as shown?
Also if the condition of the versions does not match i assume the message box would appear put the system modal once the user clicks message box the app would close, correct?
If the condition DOES match the message box would not appear and the form would load to allow user to proceed using the database.
I appreciate the help. :banghead:
Option Compare Database
Option explicit
'existing code to load default dates
Private Sub Form_Load()
Me![txtCY] = DLookup("[gCurrentYear]", "a_tbl_SkyView_DefaultDates")
Me![txtNY] = DLookup("[gNextYear]", "a_tbl_SkyView_DefaultDates")
Me![txtVersion] = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal")
End Sub
Private Sub Form_Load2()
Dim strVersion As String
'Local table with front end version is "xx_tbl_SkyViewFP_SysVersionLocal.LocalversionNbr
'SQL backend table for version control is
"xx_tbl_SkyViewFP_SysVersion.versionNumber
'version number in both table is text in format yyyymmdd
strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal") & ("[versionNumber]", "xx_tbl_SkyViewFP_SysVersion")
If strVersion <> "" Then
MsgBox "Version does not match with verion on table"
Application.Quit
End If
End Sub
The macro I wrote is not working so I am back to using the VBA code.
Here is the full code I have embedded on the form property OnLoad.
It appears the code is not recognizing the two tables and field names I have defined in the string.
Also I already have code for this event so do I rename form_load unique as shown?
Also if the condition of the versions does not match i assume the message box would appear put the system modal once the user clicks message box the app would close, correct?
If the condition DOES match the message box would not appear and the form would load to allow user to proceed using the database.
I appreciate the help. :banghead:
Option Compare Database
Option explicit
'existing code to load default dates
Private Sub Form_Load()
Me![txtCY] = DLookup("[gCurrentYear]", "a_tbl_SkyView_DefaultDates")
Me![txtNY] = DLookup("[gNextYear]", "a_tbl_SkyView_DefaultDates")
Me![txtVersion] = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal")
End Sub
Private Sub Form_Load2()
Dim strVersion As String
'Local table with front end version is "xx_tbl_SkyViewFP_SysVersionLocal.LocalversionNbr
'SQL backend table for version control is
"xx_tbl_SkyViewFP_SysVersion.versionNumber
'version number in both table is text in format yyyymmdd
strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal") & ("[versionNumber]", "xx_tbl_SkyViewFP_SysVersion")
If strVersion <> "" Then
MsgBox "Version does not match with verion on table"
Application.Quit
End If
End Sub