Re: Nothing is happening

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Thu, 31 Jan 2008 06:09:02 -0800, Jonathan Brown
<JonathanBrown@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

For some reason, nothing is happening. I'm not even getting an error
message or a compile error. I've got the proper references selected for DAO
3.6, etc. It's just that nothing happens when I click the add button.

Well, in order to see any query errors you need the dbFailOnError parameter.
Let's see what else:

On Error GoTo Err_cmdAdd_Click

If IsNull(Me.cboBillets) Then

I take it that cboBillets is in fact not NULL?

Exit Sub
Else

Dim db As Database
Dim strSQL As String

Set db = CurrentDb()
strSQL = "INSERT INTO tblBilletsJoin (ClearanceNum,BilletNum) VALUES ("" &
Me.ClearanceNum & "", "" & Me.cboBillets "")"

Are both these fields TEXT datatypes? If not you don't need the ' around them.
If you step through in debug mode, what is the actual value of strSQL?

db.Execute strSQL, dbFailOnError ' this should be added

Me.lstBillet.Requery
Set db = Nothing

End If

Exit_cmdAdd_Click:
Exit Sub

Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click




ONE BIG QUESTION: *why?*

It looks like all you're doing is selecting a billet in a combo box and
creating a new record.

You can do this with NO CODE AT ALL simply by using a Subform based on
tblBilletsJoin, using ClearenceNum as the master/child link field, and putting
a combo box on the subform. Could you explain why you're trying to do it the
hard way????

John W. Vinson [MVP]
.


Quantcast