B
Brian
Can someone please tell me if I am going in the right direction with this...
Don't want to spend too much time if I am way off... Thanks for any advice
in advance.
I am trying to produce a database for card issues. As one of this database
should be accessable from three locations allowing users to enter the data I
have opted for an access project adp linked to SQL server at head office.
Although I have written some simple mdb databases this is my first time
using an adp & SQL.
I have created two tables:
tbl_customers:
cust_id, datestamp, title, forename, surname, address1, address2, district,
town, county, postcode, email, contactpref, contactnil, dob,
ageverification, comments
tbl_cardissues
cust_id, cardserial, carddesc, issuedate, startdate, expirydate, comments
I have created a one2many relationship between the two forms in the database
diagram.
I have created a form with a subform (initially bound fields to table...)
The form & subform have now got an ADO recordset to fill the fields.
As this is my first database frontend to SQL I am unsure if this is the way
to go... I obviously want to limit the data across the network to ensure the
speed is usable at remote sites, so am unsure if i should have used a stored
procedure?
The only code i have is (as I am using Access2k, this is the example i found
at ms which required MSDatashape). This appears to work well for th main
part of the form but when data is entered into the subform it fails and when
playing with the subform the CUST_ID was issuing a new id not related to the
main form...:
frm_customers:
----------------
Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "MSDataShape"
'The code below uses a server name, user ID, and password.
'Be sure to use your actual server name, user ID, and password.
.ConnectionString = "DATA PROVIDER=SQLOLEDB;DATA
SOURCE=(local);DATABASE=wdcardsSQL;UID=sa;PWD=sapassword;"
.CursorLocation = adUseServer
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "SELECT * FROM tbl_customers"
.ActiveConnection = cn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With
Set Me.Recordset = rs
Me.UniqueTable = "tbl_customers"
End Sub
frm_cardissues:
----------------
Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "MSDataShape"
'The code below uses a server name, user ID, and password.
'Be sure to use your actual server name, user ID, and password.
.ConnectionString = "DATA PROVIDER=SQLOLEDB;DATA
SOURCE=(local);DATABASE=wdcardsSQL;UID=sa;PWD=letmein;"
.CursorLocation = adUseServer
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "SELECT * FROM tbl_cardissues"
.ActiveConnection = cn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With
Set Me.Recordset = rs
Me.UniqueTable = "tbl_cardissues"
End Sub
Thanks for any advice offered
Brian
(e-mail address removed)
Don't want to spend too much time if I am way off... Thanks for any advice
in advance.
I am trying to produce a database for card issues. As one of this database
should be accessable from three locations allowing users to enter the data I
have opted for an access project adp linked to SQL server at head office.
Although I have written some simple mdb databases this is my first time
using an adp & SQL.
I have created two tables:
tbl_customers:
cust_id, datestamp, title, forename, surname, address1, address2, district,
town, county, postcode, email, contactpref, contactnil, dob,
ageverification, comments
tbl_cardissues
cust_id, cardserial, carddesc, issuedate, startdate, expirydate, comments
I have created a one2many relationship between the two forms in the database
diagram.
I have created a form with a subform (initially bound fields to table...)
The form & subform have now got an ADO recordset to fill the fields.
As this is my first database frontend to SQL I am unsure if this is the way
to go... I obviously want to limit the data across the network to ensure the
speed is usable at remote sites, so am unsure if i should have used a stored
procedure?
The only code i have is (as I am using Access2k, this is the example i found
at ms which required MSDatashape). This appears to work well for th main
part of the form but when data is entered into the subform it fails and when
playing with the subform the CUST_ID was issuing a new id not related to the
main form...:
frm_customers:
----------------
Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "MSDataShape"
'The code below uses a server name, user ID, and password.
'Be sure to use your actual server name, user ID, and password.
.ConnectionString = "DATA PROVIDER=SQLOLEDB;DATA
SOURCE=(local);DATABASE=wdcardsSQL;UID=sa;PWD=sapassword;"
.CursorLocation = adUseServer
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "SELECT * FROM tbl_customers"
.ActiveConnection = cn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With
Set Me.Recordset = rs
Me.UniqueTable = "tbl_customers"
End Sub
frm_cardissues:
----------------
Sub Form_Open(Cancel As Integer)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
With cn
.Provider = "MSDataShape"
'The code below uses a server name, user ID, and password.
'Be sure to use your actual server name, user ID, and password.
.ConnectionString = "DATA PROVIDER=SQLOLEDB;DATA
SOURCE=(local);DATABASE=wdcardsSQL;UID=sa;PWD=letmein;"
.CursorLocation = adUseServer
.Open
End With
Set rs = New ADODB.Recordset
With rs
.Source = "SELECT * FROM tbl_cardissues"
.ActiveConnection = cn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With
Set Me.Recordset = rs
Me.UniqueTable = "tbl_cardissues"
End Sub
Thanks for any advice offered
Brian
(e-mail address removed)