10-10-2000, 07:44 PM
Join Date: Jan 2000
Access DB Update problem
Hello. I am making an app and i need to be able to update my database through me app. In my data base, 6 tables. One of them is my Data table, in which all the stuff is stored. I made an SQL statement to pull stuff from the other tables and put it into the data table. I also made relations between the tables.
Now when I update though VB, it gives me an error saying so and so is not in the record set.
1 |1 |Hello |1 |1 |1
2 |2 |Bye |2 |2 |2
This is basically what my data table looks like. Where there is a number is where other data will be put in. The numbers under "DataID" is the autonumber. Basically what my SQL statement does is say where ever there is a "1" in the data table, place what ever is in the first name table that has an ID of "1" in the spot on the table of the data where table data has a number of "1" and under the first name column.
Now how would I update this?
I have a form that has the user put the info into a text box and when I update it my code looks as so:
Set Rs = Db.OpenRecordset("SELECT * FROM Data")
!LastName = LastName.Text
!Firstname = Firstname.text
!state = state.text
!city = city.text
!zip = zip.text
!address = address.text
Set Rs = Db.OpenRecordset("SELECT [City].[City], [Zip].[Zip], [FirstName].[FirstName], [State].[State], [Address].[Address], [Data].[DataID], [Data].[LastName]From City, Zip, FirstName, State, Address, Data WHERE [Data].[FirstNameID]=[FirstName].[FirstNameID] And [Data].[StateID]=[State].[StateID] And [Data].[ZipID]=[Zip].[ZipID] And [data].[AddressID]=[Address].[AddressID] And [Data].[CityID]=[City].[CityID];")
I hope all this makes sense.
If I need to be clearer, please respond.