Take data from an unbound text box and add it as a data in a new record

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I have a Split form which has a search query box (Text711)
Code:
Private Sub Text711_Change()
    Me.Requery
    Me.Text711.SetFocus
End Sub

If the results come up blank I want the user to be able to click a button to add a new record but I also want to take the data in TExt711. that ended in a null search, and add it so the user doesn't have to retype it.

Code:
Private Sub Command87_Click()
On Error GoTo Command87_Click_Err

    On Error Resume Next
    DoCmd.GoToRecord , "", acNewRec
    If (MacroError <> 0) Then
        Beep
        MsgBox MacroError.description, vbOKOnly, ""
    End If


Command87_Click_Exit:
    Exit Sub

Command19_Click_Err:
    MsgBox Error$
    Resume Command87_Click_Exit
    
'Take the data entered in Text711 and add it to BidItem_Number as the data for the new record
    
    
    
    

End Sub

The field to add it to is BidItem_Number

Is this possible?

The record source is: SELECT tblBidItemData.*, tblBidItemData.BidItem_Number FROM tblBidItemData WHERE (((tblBidItemData.BidItem_Number) Like [forms]![frmBidItems]![Text711] & "*")) ORDER BY tblBidItemData.BidItem_Number;
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Presuming the field BidItem_Number is on the form and bound to the table then just add
Me.BidItem_Number = Me.Text711 after you create the new record.

BTW when you come back to this in a few months time, Text711 is not going to mean much. :)
Better to rename the controls to what they are meant to represent after they are created.?
 
Upvote 0
Thanks! I already did change that. I was using that until I could figure out how to get to point A. Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top