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

how to format a text box????

Status
Not open for further replies.

Parula

Programmer
May 10, 2001
18
US
i have created a combo box that when the user enters in a zip code it give the total number of records that meet that criteria. i also have a text box that i would like the user to enter in the x number to append to a table. i am giving you my code for the combo box which should help you. How do i take input from the user and update a table?

Option Compare Database
Option Explicit

Private Sub zip_code_AfterUpdate()

End Sub

Private Sub zip_code_1_BeforeUpdate(Cancel As Integer)

End Sub
Private Sub Send_Click()
On Error GoTo Err_Send_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "an_sent"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acTable, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Send_Click:
Exit Sub

Err_Send_Click:
MsgBox Err.Description
Resume Exit_Send_Click

End Sub

Private Sub Combo101_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Combo114_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Combo114_Enter()

End Sub

Private Sub Combo118_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Combo122_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Combo80_AfterUpdate()

End Sub

Private Sub Combo80_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub Combo80_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

End Sub

Private Sub Combo84_BeforeUpdate(Cancel As Integer)

End Sub
 
Hello Parula,

You can use the VBA RunSQL command to append the records from Table1 to Table2 like so:

DoCmd.RunSQL "INSERT INTO TABLE2 " _
& "(FIELDONE, FIELDTWO, FIELDTHREE )" _
& "SELECT FIELDONE, FIELDTWO, FIELDTHREE FROM TABLEONE " _
& "WHERE ZIPCODEFIELD ='" & ComboBoxName & "'"

Hope this helps...B-) ljprodev@yahoo.com
Professional Development
MS Access Applications
 
Lonnie

i wanted to know if you have checked you email tonight? i email your my program. i am going to try out this code you sent me. i would like you to look at the program i am working on.

thank you
Parula
parula28@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top