Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Link to SQL

Status
Not open for further replies.

ninash

Technical User
Jul 6, 2001
163
GB
Hi All
I have an Access 2000 DB that has linked tables to a SQL DB.

The SQL DB is active and I can read from the tables ... But.

I need to write to and append data to these tables.

I have full admin rights to the SQL DB but still can't make any form of data write to it....

Any clues on where I am going wrong?.

Ta
Tony
 
to edit data you need a primary key set for the table or when you link to the sql table select a unique record identifier.
 
Thank you very much drctx
That took care of the ability to write to the database but now I get a type mismatch error trying to write to the SQL database.

I have listed my code below but I can't see why the select line would throw up this error as it is only selecting data from the database.

Private Sub AddClientButton_Click()
Dim rstAddClient As Recordset
Dim Message, Title, Default As String
Dim NewClientName As String

Message = "Input name of client in proper case format"
Title = "New Client Entry"
Default = "Client Name"
'Display inputbox with message, title and default value.
NewClientName = InputBox(Message, Title, Default)

If NewClientName = "Client Name" Then
NewClientName = ""
End If

If NewClientName <> "" Then
Set rstAddClient = CurrentDb.OpenRecordset("select [Client Name], [ClientCounter] from [dbo_Client]")
'Add New Record Here
With rstAddClient
.AddNew
'Field references to rstSQ to update Questionaire table
![Client Name] = NewClientName
![ClientCounter] = 4
.Update
End With
rstAddClient.Close
End If

MsgBox NewClientName

End Sub

The number 4 will be replaced with a max + 1 Statement to ensure a unique counter number is used.

Thanks for any help you can give.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top