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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a New record with a specific data displayed 1

Status
Not open for further replies.

BrenoAguiar

IS-IT--Management
Feb 8, 2005
81
US
Hello again.

How can I, after have a record deleted from a table, have a form opened ready for a new record to be insert? Or better: A form opened in a blank record and a certain data placed in a field. I have the record deleted using:

DoCmd.RunSQL "DELETE FROM [owner's list] WHERE [owner's list].[Computer code] = '" & Me![Computer Code] & "'"

The thing is once this record is deleted, the user needs (mandatory) to add a new record with the same [Computer Code] and that code is whats beeing used as a link criteria.

Thanks again for the ALLWAYS great help you guys give out!
 
You may with the DefaultValue property of the TextBox object.
Or run an UPDATE query instead of a DELETE one.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You may play with the DefaultValue property of the TextBox object.
Or run an UPDATE query instead of a DELETE one.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How can I run an UPDATE query using the SQL to UPdate more than one field only ? I have one running like this:

DoCmd.RunSQL "UPDATE [Owner's list] SET [E-mail] = NULL WHERE [owner's list].[Computer code] = '" & Me![Computer Code] & "'"


Example: can I set [E-mail] & [Flag1] & [LAstname] & [MI]=Null ?

 
[tt]
DoCmd.RunSQL "UPDATE [Owner's list] SET [Owner's list].[E-mail]=NULL, [Owner's list].[Flag1]=NULL, [Owner's list].[Lastname]=NULL WHERE [Owner's list].[Computer code] = '" & Me![Computer Code] & "'"[/tt]

Do you really have an apostrophe in your table name? [lol]

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
I know its crazy but I do. I got this Access Db developed by someone else years ago and I have to make several changes in the whole thing. That's why I'm Allways here asking for your Help!

Not only that but that person used spaces, dashes, you name it...

That was What I needed! Thanks. How can I, after having a Form ("owners") opened in a New record (acNewRec), send a value ([Computer Code]) that is active in another form ("owners_archive")?
 
Code:
Private Sub Form_Current()
  If Me.NewRecord Then
    If CurrentProject.AllForms("owners_archive").IsLoaded Then
      Me!txtComputerCode.DefaultValue = "=" & Chr(34) & Forms![owners_archive]![Computer Code] & Chr(34)
    End If
  End If
End Sub

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Great! That worked perfectly.
Thanks Again and here is another one for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top