G
G Lam
Hi, I have the following code for a Form, but when I click on the button, it
pops up MSG boxes asking for FirstStr and LastStr. The data in the resulting
table are right (between and include the FirstStr and LastStr). I don't
understand why it asks for input, because I had hard coded them in the SUB.
Although, what I finally would want to do is ask for user input, but I need
to write some more codes to limit the input range. Here are the code:
Thank you in advance.
Gary
Private Sub Maketable_Click()
On Error GoTo Err_Maketable_Click
Dim FirstStr As String
Dim LastStr As String
FirstStr = "987654327"
LastStr = "987654333"
DoCmd.RunSQL "Select TblBsd.Barcode, Tblbsd.Description INTO [BSDBak]" _
& "From TBLBSD Where TBLBSD.Barcode Between """"&FirstStr&"""" And
""""&LastStr&"""";"
Exit_Maketable_Click:
Exit Sub
Err_Maketable_Click:
MsgBox Err.Description
Resume Exit_Maketable_Click
End Sub
pops up MSG boxes asking for FirstStr and LastStr. The data in the resulting
table are right (between and include the FirstStr and LastStr). I don't
understand why it asks for input, because I had hard coded them in the SUB.
Although, what I finally would want to do is ask for user input, but I need
to write some more codes to limit the input range. Here are the code:
Thank you in advance.
Gary
Private Sub Maketable_Click()
On Error GoTo Err_Maketable_Click
Dim FirstStr As String
Dim LastStr As String
FirstStr = "987654327"
LastStr = "987654333"
DoCmd.RunSQL "Select TblBsd.Barcode, Tblbsd.Description INTO [BSDBak]" _
& "From TBLBSD Where TBLBSD.Barcode Between """"&FirstStr&"""" And
""""&LastStr&"""";"
Exit_Maketable_Click:
Exit Sub
Err_Maketable_Click:
MsgBox Err.Description
Resume Exit_Maketable_Click
End Sub