473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

VBA remote serial validation

tuxalot
200 100+
Hi guys,

I have an access db that I want to share with users for testing. The functionality I would like to implement is below. Is this possible with Access?

1. first run of db user is presented with form to enter serial. Serial is saved in local table for successive opens.
2. db checks for internet connection.
3. if internet connection, serial entered is checked against values in remote web accessible MySQL database.
4. if serial is found, db opens. If not found, db closes.
5. if no internet connection, db stores serial in local table and increments a numeric field allowing only three opens without validating remote serial.

Seems like a fairly standard piece of code but I can't seem to find an existing solution that I can tailor to fit my needs.

Any nudges in the right direction so I can begin to research how to get this done would be most appreciated.

Thanks to all!
Dec 9 '11 #1
13 1840
NeoPa
32,556 Expert Mod 16PB
You haven't really made clear what a serial is or refers to in this Tux, but otherwise it's been well thought through. That's the first step done. I would suggest the next step is to start coding it and seeing where you get stuck. Then we may be able to assist. There's not really much of a question at this stage though.
Dec 9 '11 #2
Rabbit
12,516 Expert Mod 8TB
With your scheme, all I have to do to get around your validation is decrement the counter in the table.
Dec 9 '11 #3
tuxalot
200 100+
Expand|Select|Wrap|Line Numbers
  1. You haven't really made clear what a serial is or refers to in this Tux
A unique serial number will be generated by an admin and issued to each authorized user of the database and sent to them via email.

Expand|Select|Wrap|Line Numbers
  1. With your scheme, all I have to do to get around your validation is decrement the counter in the table.
Point taken. I'm sure if a user cracked the password to the backend they could do that. I suppose I could upload the value of the counter in the local table when Internet access becomes available and check against a remote value of the same data to see if any monkey business has occurred. I had planned on putting the typical recipe of Access protections in place, i.e. splitting, password protecting front and back ends, making an MDE of the front end, and maybe running the front end through MDE Compiler.
Dec 10 '11 #4
ADezii
8,834 Expert 8TB
What, exactly are you not sure of, if it is the checking for an Internet Connection you could try:
Expand|Select|Wrap|Line Numbers
  1. 'Declare in a Standard Code Module
  2. Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Expand|Select|Wrap|Line Numbers
  1. Dim lngRetVal As Long
  2.  
  3. lngRetVal = InternetGetConnectedState(0&, 0&)
  4.  
  5. If lngRetVal = 0 Then
  6.   'Code for NO Internet Connection
  7.   '...
  8. Else
  9.   'Code for an Internet Connection
  10.   '...
  11. End If
  12.  
Dec 10 '11 #5
NeoPa
32,556 Expert Mod 16PB
As ADezii and I have now both said, what is the question you want answered? Serial is clearly a unique User ID, that's fine and the whole scenario makes sense, but what do you need from us now? You already have the logic laid out, so you're not asking us how to do that.
Dec 10 '11 #6
tuxalot
200 100+
From my original post:
Is this possible with Access?
That was the question. And whether or not the logic seems reasonable. With your post #6 NeoPa, now that is answered. Thanks for that. At least I know my logic makes sense outside of my own head.

Think of it this way. If a student were to come to you with the same question as in my first post, and wanted to know where to go and what topics to research to learn about how to code this, how would you respond?

Any nudges in the right direction so I can begin to research how to get this done would be most appreciated.
In a nutshell, that is what I was asking.

Thanks for the code ADezii.
Dec 10 '11 #7
NeoPa
32,556 Expert Mod 16PB
Tuxalot:
Seems like a fairly standard piece of code but I can't seem to find an existing solution that I can tailor to fit my needs.
From your original post I was assuming it wasn't quite as simple as that.

However, if that's what you want then I would answer that the idea is certainly possible in Access, and that the way forward is simply to follow the outline you've already laid out. You know what Serial pertains to in your list so you have all you've asked for I guess.
Dec 11 '11 #8
tuxalot
200 100+
Onward!

I was able to get a linked table setup using ODBC. But after a minute of inactivity the connection is lost. I call this function from a button, but I get a runtime error 3146 "ODBC call failed" at tdf.RefreshLink:

Expand|Select|Wrap|Line Numbers
  1. Function relinkTables()
  2. Dim tdf As DAO.TableDef
  3.  
  4.     For Each tdf In CurrentDb.TableDefs
  5.         ' check if table is a linked table
  6.         If Len(tdf.Connect) > 0 Then
  7.             tdf.Connect = "ODBC;Driver=MySQL ODBC 5.1 Driver;SERVER=<myserver>;DATABASE=<mydatabase>;UID=<myuserID>;PASSWORD=<mypassword>;PORT=3306;DFLT_BIGINT_BIND_STR=1;TABLE=clients"
  8.             tdf.RefreshLink '<<< RUNTIME ERROR HERE
  9.         End If
  10.     Next
  11.  
  12. End Function
<placeholders> in connection string are intentional ;)
Dec 11 '11 #9
ADezii
8,834 Expert 8TB
tdf.RefreshLink is probably failing because a Connection is not being made via tdf.Connect. Double check your Connection Parameters.
Dec 11 '11 #10
NeoPa
32,556 Expert Mod 16PB
It always helps to make the connection manually and see what the .Connect property is set to.
Dec 11 '11 #11
tuxalot
200 100+
NeoPa, I did make the connection manually and copied the connection string from the linked tables description in the properties window. But the connection keeps dropping if there is no activity for a minute or so. Seems like a timeout?

EDIT: On my Windows XP machine I went to Control Panel > Administrative Tools > Data Sources (ODBC) and selected my data source in the File DSN tab. Selected configure and then expand the details window below and on the connection tab put a checkmark in the box entitled "Enable automatic reconnect". So far so good. Connection seems stable now although if does seem that it takes a few seconds longer to show the table when double clicking the linked table in Access.
Dec 11 '11 #12
ADezii
8,834 Expert 8TB
Could the Code be falling through and executing the RefreshLink prior to the actual Connection being made?
Dec 11 '11 #13
tuxalot
200 100+
Could the Code be falling through and executing the RefreshLink prior to the actual Connection being made?
This is a possibility ADezii. But for now with the change I made in post #12 it seems to be connecting fine, even following periods of inactivity.

I am wondering how secure this solution is. I know little to nothing about ODBC. Is the user/pass for the remote db exposed on the users machine anywhere? This database will be deployed as a trial to a very limited number of people and is simply being used at this point to get feedback for additional development. Time to study up on security.
Dec 11 '11 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
3
by: CJM | last post by:
I'm adding some extra features to an intranet-based ASP application...(IE6 clients) As part of the process, I thought I would give the html a mid-life upgrade, ie. remove much of the tag-soup,...
1
by: Paul | last post by:
Hi Guys, I have written an application in Visual C#, I wish to add serial number validation dll to the installer, how do I go about doing this. Thanks in advance. Paul Mathebula
1
by: Jack Wheeler | last post by:
I have a basic form with some textboxes and several requiredfielfvalidators. On my development machine, the validation for this form works fine. On the remote server, the form posts back with no...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
8
by: vicky | last post by:
Hello,I met a question when I wrote the program.I want the program can transmit the data frame continuosly through the RS232 when the communication has been interrupted.But I don't know how to...
1
by: diffuser78 | last post by:
I just started to write a small project in Python. I was wondering if there can be something like remote boot manager. I have to remotely start a computer. It has dual boot (WinXP and Linux)....
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
7
by: Adele le Roux | last post by:
Hi All, How can I get the hard disk serial number of a remote computer's C:? The drive will NOT be mapped as a network drive. Thanks, Adele
7
by: Nickolai Leschov | last post by:
Hello, I am working on an industrial automation project that involves programming the i188 PC-compatible controller with embedded DOS and several serial ports. What options do I have for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.