version control text string comparison

Thanks Pat
Going to give this a try. I am having a learning curve therefore studying at night to sharpen my skills. I appreciate the help and patience. I work with the syntax which has been part of my issue as well. Tracy

What event is Form_Load2()? I'm pretty sure this isn't valid. If you want something to run when the form loads, it needs to go into the Form_Load() event. There is only a single load event for a form.

The DLookup() is not formatted correctly:
strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal") & ("[versionNumber]", "xx_tbl_SkyViewFP_SysVersion")

I'm not sure I can identify which of your names to use where so I'll substitute.

strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal", "LocalversionNbr = '" & yourremoteversionnumber & "'")

Even though there is only a single row in the version table, this code is using criteria to return that row ONLY if it matches the remote version number. That means that you need to either add a preceding DLookup() to get yourremoteversionnumber OR substitute an embedded DLookup() to get it in the expression like this:

strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal", "LocalversionNbr = '" & DLookup("RemoteVersionNbr", "xx_tbl_SkyViewFP_SysVersionRemote") & "'")

As with all air code, this may contain syntax errors.
 
Here is the code almost working, now receiving runtime error 94 invalid use of Null. appears to be on the string dlookup line. I see other examples on web using Nz or IsNull …

these two tables will only have one record, neither have a null in the version number field in table at this time

the two table names and field names are shown properly in the string below.
I wonder if the string is proper with the identifier on end & ""

at the moment I comment out the action till I get this code working properly

I have the code running on a test form..

TY for help and patience

Option Compare Database
Option Explicit

Private Sub Form_Load()
Dim strVersion As String
strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal", "LocalversionNbr = '" & DLookup("[versionNumber]", "xx_tbl_SkyViewFP_SysVersion") & "'")
If strVersion <> "" Then
MsgBox "Version does not match with version on table"
'add action here
'Application.Quit
End If
End Sub



What event is Form_Load2()? I'm pretty sure this isn't valid. If you want something to run when the form loads, it needs to go into the Form_Load() event. There is only a single load event for a form.

The DLookup() is not formatted correctly:
strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal") & ("[versionNumber]", "xx_tbl_SkyViewFP_SysVersion")

I'm not sure I can identify which of your names to use where so I'll substitute.

strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal", "LocalversionNbr = '" & yourremoteversionnumber & "'")

Even though there is only a single row in the version table, this code is using criteria to return that row ONLY if it matches the remote version number. That means that you need to either add a preceding DLookup() to get yourremoteversionnumber OR substitute an embedded DLookup() to get it in the expression like this:

strVersion = DLookup("[LocalversionNbr]", "xx_tbl_SkyViewFP_SysVersionLocal", "LocalversionNbr = '" & DLookup("RemoteVersionNbr", "xx_tbl_SkyViewFP_SysVersionRemote") & "'")

As with all air code, this may contain syntax errors.
 
Hi Pat
You hit the nail on the head, data definitely not coming through as TEXT.

I have other technical issues going on that may be impacting the VBA code - data types. I am testing ODBC driver updates for SQL 2016 due to Access issues with linking to SQL2016 data types.

Probably a bad time for me to try to implement this code until I resolve these issues and finish the SQL 2016 upgrade. I am working on upgrading FMS system from SQL2008 to SQL2016.

Meanwhile I am going to continue testing/using the code eliminating the other tech components I am managing at this moment in other systems. Jet/ODBC and SQL database upgrades are the biggest challenge for me at the moment I should of realized this sooner. My apologies..

:banghead:

Thanks for the help. Tracy
 

Users who are viewing this thread

Back
Top Bottom