I suggest you re-read what Cody wrote.
On Dec 23, 7:39 pm, Snoopy33 <[email protected]> wrote: > I've tried this, but it doesn't hold the null value. > > Dim dbn As String > > Me.DealerCustIDfkTextBox.Text = System.DBNull.Value.ToString > (dbn) > > Me.Validate() > Me.OrdertblBindingSource.EndEdit() > Me.OrdertblTableAdapter.Update(Me.DataSet1.Ordertbl) > > and btw these are relationship only between the PK's and FK's > > On Dec 22, 3:22 pm, Cody <[email protected]> wrote: > > > > > When posting it back to the SQL server set the field to DBNull.Value > > > You can't put that inside a textbox's .text property though, which > > means in your database access function that does the write you'll > > likely have to check for a blank value and then set it to DBNull.Value > > just before executing the query back to the server. > > > On Dec 22, 12:05 pm, Snoopy33 <[email protected]> wrote: > > > > I'm having difficulty with what seems like should be a very simple > > > operation. > > > > I have two tables. > > > > Orders with (simplified) fields OID > > > > with two other tables > > > Customers with fields Cid and OrderIDFK > > > and > > > Locations with fields LID and OrderIDFK > > > > everything works great. If i select a customer from a drop box, the > > > foriegn key populates in the appropriate field in the record. > > > > If i select a Location for the customer it also populates correctly. > > > > How would i go about removing the key from the > > > LocationOrderIDFKtextbox field and reset it to Null so that the > > > customer location shows blank? > > > > I've tried the following > > > > locationOrderIDFKtextbox.text = nothing > > > and > > > > locationOrderIDFKtextbox.text = "DBNull" > > > and > > > > locationOrderIDFKtextbox.text = "<DBNull>" > > > > all three momentairly remove the field. The problem is that when i > > > save the record, goto another record, and then return, the Location FK > > > is back in place. > > > > I'm saving using the endedit and update methods which saves data > > > perfectly everywhere else. I'm sure that the problem is that the > > > field is not being updated to Null because I can go into the SQL > > > Server and copy a null field into that field and the change stays. > > > > How do i do this programatically using VB? > > > > Thanks for any help.- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
