How to Passing Data to another Database

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I am working on a database to keep customer credit card information - until
the order is processed. Obviously I want it password protect which I can do.
However I am going to keep it seperate from my Order Entry Database. So my
plan is to have a button or event that when credit card is the payment method
the system would open the credit card database and prompt for password and
then the form would open as a new record. What I'd like todo however is pass
the customer account# and the Order# along so that it populated that info in
the credit card database, so that when our AR person could process the credit
card payment and be able to look it up based on the order#.

So the question is - can I pass that type of info from one database to
another? If so, what would be the code?

Thanks for anyone's input. I am also open to another suggestion on how I may
better handle this issue.

Matt
 
D

DStegon via AccessMonster.com

Of course you can. You can set the connection String that you open to be the
database of your CC info. You can read those records just as if yoru were
reading "currentproject.connection". You can have multiple connections open
and read and write from them.

Public cnnProductConversion As ADODB.Connection (or private)
Private PathToInfo as String
Set cnnProductConversion = New ADODB.Connection

PathToInfo = CurrentProject.path & "\CCInfo.mdb" (if table is in same folder.
. if not change that)
cnnProductConversion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.
0;Data Source=" & PathToInfo
cnnProductConversion.Open

With rstb
.Open "SELECT * FROM tbl_CC_Info WHERE Contact_ID=" & CONTACTID,
cnnProductConversion, adOpenKeyset, adLockOptimistic


Go it????



One word of caution. DO NOT GET CAUGHT storing a customers credit card
information that is outside the Consumer Protection Act of (i think 2001..
you can google it). There are specific requirements that must be followed
and if they are not there is a fine of $500,000 per incident.
 
M

mattc66 via AccessMonster.com

Okay I am not sure I get it. Here is my attempt at the code.

It doesn't seem to like the word Public and when I put it in a Private event
it didn't like ADODB.

Public cnnProductConversion = ADODB.Connection
Dim PathToInfo As String
Set cnnProductConversion = New ADODB.Connection

PathToInfo = "w:\backend\drac_db.mdb"
cnnProductConversion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.
0;Data Source=" & PathToInfo
cnnProductConversion.Open

With rstb
.Open "SELECT * FROM tblCreditCard WHERE QuoteID=" & QuoteID, _
cnnProductConversion, adOpenKeyset, adLockOptimistic

End Sub

Of course you can. You can set the connection String that you open to be the
database of your CC info. You can read those records just as if yoru were
reading "currentproject.connection". You can have multiple connections open
and read and write from them.

Public cnnProductConversion As ADODB.Connection (or private)
Private PathToInfo as String
Set cnnProductConversion = New ADODB.Connection

PathToInfo = CurrentProject.path & "\CCInfo.mdb" (if table is in same folder.
. if not change that)
cnnProductConversion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.
0;Data Source=" & PathToInfo
cnnProductConversion.Open

With rstb
.Open "SELECT * FROM tbl_CC_Info WHERE Contact_ID=" & CONTACTID,
cnnProductConversion, adOpenKeyset, adLockOptimistic

Go it????

One word of caution. DO NOT GET CAUGHT storing a customers credit card
information that is outside the Consumer Protection Act of (i think 2001..
you can google it). There are specific requirements that must be followed
and if they are not there is a fine of $500,000 per incident.
I am working on a database to keep customer credit card information - until
the order is processed. Obviously I want it password protect which I can do.
[quoted text clipped - 13 lines]
 
D

DStegon via AccessMonster.com

NO "=" sign... you are declaring an object here.
Ok.... have your routine call this function that you put in your form

YOUR_CC_Number_Variable = GetCCData( QuoteID )

--------------------------

Private Function GetCCData(QuoteID As Long) As String
Dim cnnCCData As New ADODB.Connection
Dim PathToInfo As String
Dim CCData As String
Dim rstb As New ADODB.Recordset

Set cnnCCData = New ADODB.Recordset
PathToInfo = "w:\backend\drac_db.mdb"
cnnCCData.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& PathToInfo
cnnCCData.Open

With rstb
.Open "SELECT * FROM tblCreditCard WHERE QuoteID=" & QuoteID, cnnCCData,
adOpenKeyset, adLockOptimistic
If Not .eof Then CCData = CStr(!YOUR_FIELD_NAME_HERE)
.Close
End With

cnnCCData.Close

GetCCData = CCData

End Function


-------------

not knowing how your cc info is formatted I made it string and then you can
do anything with it after that. Did not know if you put in dashes and stuff
(ie - 5432-6892-....-....)

I have have the calling form check to make sure that the len of what is sent
back is greater than 0. If it is "0" then there were no matching records in
the CC Data and you should handle that kindly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top